hello everybody,
i have this script, and i cannot get this to pass to the correct page. It only goes to ELSE section of the statement:
Any ideas why it won't forward correctly?
target page:
---------------------------------------------------------------------------------
<?
if (isset($_GET['page']) && $_GET['page'] != '') {
Switch ($_GET['page']) {
Case "corporate":
$url = "corporatepage";
break;
Case "usatf":
$url = "usatfpage";
Break;
Case "school":
$url = "schoopage";
Break;
Case "volunteer":
$url = "volunteerpage";
Break;
Case "youth":
$url = "youthpage";
Break;
}
Header('Location: ' . $url);
}
else {
$url = "........page that is always fowarded to";
Header('Location: ' . $url);
}
?>
-----------------------------------------------------------------------
this always goes to the ELSE page.
thanks,
-Michael
switch redirect problem
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
a better way to check it its set or empty is
empty checks to see if it is even set, if not the statement fail and it also checks to see if the value of NULL, and if so it will fail .. because we have made the empty inversed.
Try echo'ing your variables to see if they are being set.
ie echo $_GET['page']; at the bottom of your page.
Code: Select all
<?php
if (!empty($_GET['page'])) {
?>Try echo'ing your variables to see if they are being set.
ie echo $_GET['page']; at the bottom of your page.