Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

header problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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??
nate
New php-forum User
New php-forum User
 
Posts: 3
Joined: Tue Aug 20, 2002 10:41 am

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
DoppyNL
 

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");
}   
Jay
 


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 4 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.