
12-03-09, 04:42 PM
|
 |
-
|
|
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
|
|
Another option:
PHP Code:
/* Default page - either the same page, or an error page */
$sPage='default.php';
/* Ensure both ids are set. It's okay if they are set but empty */
if (isset($_POST['id1']) && isset($_POST['id2']))
{
$aPageMap=array('101'=>'page1.php',
'102'=>'page2.php',
'103'=>'page3.php',
'201'=>'page4.php',
'202'=>'page5.php',
'203'=>'page6.php',
'301'=>'page7.php',
'302'=>'page8.php',
'303'=>'page9.php');
/* Create the array index - it's okay if it is not valid */
$iPageIndex=$_POST['id1'].$_POST['id2'];
/* Check to see if the array index is valid, if so, use it */
if (array_key_exists($iPageIndex,$aPageMap))
$sPage=$aPageMap[$iPageIndex];
}
/* Go to the page */
header('location: '.$sPage);
This could also be done in javascript, like so:
Not tested.
|