header problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

nate
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Aug 20, 2002 10:41 am
Contact:

header problem

Postby nate » Tue Aug 20, 2002 4:34 pm

can the cookie work together with header()?

i can't get my cookie after i use the header()

my code is as below :

if($done!=1)
{
header("Location:$PHP_SELF?done=1");
setcookie("cookie_1", "test");
}
else
{
header("Location:http://ejmen.com/dealer/index.php");
}

i can't get the value i have already set after the page has been redirect. is there any solution??

DoppyNL

Postby DoppyNL » Tue Aug 20, 2002 11:42 pm

http://www.php.net/manual/en/reserved.variables.php

you have to acces $done with $_COOKIE['done'] or $_REQUEST['done']
(read the manual page and you'll understand)

Greetz Daan

Jay

Re: header problem

Postby Jay » Wed Aug 21, 2002 3:07 am

Try switching the lines around:

Code: Select all

if($done!=1)
{
   setcookie("cookie_1", "test");
   header("Location:$PHP_SELF?done=1");
}
else
{      
   header("Location:http://ejmen.com/dealer/index.php");
}   


Return to “PHP coding => General”

Who is online

Users browsing this forum: markymark and 1 guest