Creating a friendly URL

-1

I'm doing a business guide site, but when user views the details of that company the URL appears as follows:

www.nomedomeusite/detalhes.php?id_empresa=24

The id_empresa=24 is catching via $_GET['id_empresa']; .

I'd like to know if it's meant to be:

www.nomedomeusite/id_da_empresa/nome_da_empresa.html

This would be the link to access:

<a href="detalhes.php?id_empresa=<?php echo $id_empresa; ?>"><button  type="button">ver detalhes</button></a> 
    
asked by anonymous 21.06.2018 / 15:11

1 answer

0

Use a session variable like

$_SESSION['id_empresa'] 

or use a form with POST method to not appear on the site

<form action="www.nomedomeusite" method="post">
  <input type="hidden" value="24" name="id_empresa">
  <input type="submit" name="ver detalhes">
</form>

In your link you search the id like

$_POST['id_empresa'];

I hope to have helped

    
21.06.2018 / 15:46