Re: Query string???
| From: | Justin French | Date: | Mon, 18 Nov 2002 13:28:59 +0000 |
| Subject: | Re: Query string??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124898@lists.php.net to get a copy of this message | ||
So, the link might look like:
<a href="page.php?item=1">item 1</a>
Then page.php might look like this:
<?
include("{$item}.php");
?>
BUT this would be smarter:
<?
// uncomment this next line if you have register_globals OFF
// $item = $_GET['item'];
if(empty($item))
{
// set a default item number
$item = 1;
}
$file = "{$item}.php3";
if(file_exists($file))
{
include($file);
}
else
{
echo "sorry, file {$file} not found";
}
?>
Enjoy!
Justin
on 18/11/02 11:07 PM, Cyclone Médias (benjamin.trepanier@cyclonemedias.com)
wrote:
> Hi!
>
> I need to solve this problem:
>
> I have a menu bar on my main page and a dynamic zone on the others levels of
> my html/php site. When I am clicking the 'item 1' on my menu, I want to load
> item1.php3 in the dynamic section of the next page.
>
> So I think I have to use sometinng like get variable in the adress bar and
> after put on my 'next page' <include $var.php3> or something like that ?
>
>
> As you can see I'm a newbie and a quebecer so, sorry for my english and
> thanks for your help!
>
> Ben
>
Justin French
--------------------
http://Indent.com.au
Web Developent &
Graphic Design
--------------------