Multiple pages with a different id

5

I have several PHP pages, with different names of course. I wanted to have something like this home.php?id=0 , on the next page it has the name cliente.php wanted that when I have home open when clicking on cliente.php on the client menu open cliente.php only in URL it appears %.

How can I do this?

    
asked by anonymous 14.12.2015 / 13:38

3 answers

3

So I realized that when I click on the client menu I go to the script cliete.php but that the URL is home.php?id=1 .

You can put the URL of the client menu as home.php?id=1 :

<a href='home.php?id=1'>Cliente</a> 

And in the script home.php do so:

$id = filter_input(INPUT_GET, 'id');
if($id == 1)
   require('cliente.php');
    
14.12.2015 / 16:35
2

Change your webconfig to hide the .php extension, note when I say hide is just hide the .php:

<?xml version="1.0" encoding="UTF-8"?>
   <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name="exemplo 1" stopProcessing="true">
    <conditions>
      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <match url="^(.*)$" ignoreCase="true" />
    <action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
    </rule>
    </rules>
    </rewrite>
    </system.webServer>
 </configuration>
    
14.12.2015 / 16:05
-1

Just put the link together with the variable GET example:

<a href='home.php?id=<?php echo $id; ?>'>Tal cliente</a>

and make a validation to bring the client.php

    
14.12.2015 / 16:09