Zenax
Active Member
- Messages
- 1,377
- Reaction score
- 4
- Points
- 38
Ok, I need some help on a little bit of PHP code.
I got the code so that I can create the ids for each page e.g. index.php?id=1
How would I go about modifying the code so I could get: index.php?id=1&category=2
or something along those lines?
The code I have for the current index page is as follows:
obviously I have changed it to match the scenario above, just to make it simpler.
How would I go about changing this code so that it would allow: index.php?id=1&category=2
Your help is very muchly appreciated!
Regards,
Zenax
I got the code so that I can create the ids for each page e.g. index.php?id=1
How would I go about modifying the code so I could get: index.php?id=1&category=2
or something along those lines?
The code I have for the current index page is as follows:
PHP:
<?php
if( isset($HTTP_GET_VARS['id']) || isset($HTTP_POST_VARS['id']) )
{
$id = ( isset($HTTP_GET_VARS['id']) ) ? $HTTP_GET_VARS['id'] : $HTTP_POST_VARS['id'];
$id = htmlspecialchars($id);
}
else
{
$id = "";
}
switch( $id )
{
// ?id=1 This leads to section 1
case "1":
include("inc/1.php");
break;
// ?id=2 This leads to section 2
case "2":
include("inc/2.php");
break;
// The default page to load, when website is started.
default:
include("inc/main.php");
break;
}
?>
obviously I have changed it to match the scenario above, just to make it simpler.
How would I go about changing this code so that it would allow: index.php?id=1&category=2
Your help is very muchly appreciated!
Regards,
Zenax
Last edited: