page redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
theclay7
Forum Commoner
Posts: 50
Joined: Wed Feb 19, 2003 3:17 am

page redirect

Post by theclay7 »

I am trying to make a new post which requires user to login...just like the one used in here....

as you see, in the URL above, there is some value to pass "mode", "f" ....

how can I get these values again after redirect....

what I did is:

$q_id = $_REQUEST['q_id']; // just as $mode
$catID = $_REQUEST["catID"]; /// just as $f
$fromPage = "http://"
$fromPage .= $_SERVER[PHP_SELF];

if (!chkLogin) then
header ("Location: ".WWW_HTTPS_ROOT."zh_hk/main/prompt_login.php?fromPage=".$fromPage."?catID=".$catID."&q_id=".$q_id);

but then I only get $catID and NOT $q_id...
how can I get both value again....
bionicdonkey
Forum Contributor
Posts: 132
Joined: Fri Jan 31, 2003 2:28 am
Location: Sydney, Australia
Contact:

Post by bionicdonkey »

all variable pass in the url can be retrieved using $_GET. i think there's a skicky about all that stuff
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Try doing:

Code: Select all

echo '<pre>';
print_r($_GET);
echo '</pre>';
to see all of the variables from the URL.

You should be able to access the individual vars as:

Code: Select all

$q_id = $_GET['q_id']; 
$catID = $_GET["catID"];
if they've come out of a query string that looks something like:

Code: Select all

?q_id=something&amp;catID=something_else
Mac
Post Reply