Re: setcookie
| From: | George Lioumis | Date: | Wed, 17 Oct 2001 06:56:47 +0000 |
| Subject: | Re: setcookie | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-13413@lists.php.net to get a copy of this message | ||
Hi!
In page1 you should set the cookie like this:
if (!isset($cookie_name))
{
setcookie("cookie_name","cookie_value",time()+secs);
}
<HTML>...........</HTML>
In page2 you should do the following to read the cookie's value:
if (isset($cookie_name))
{
$a_var = $cookie_name;
}
<HTML>...............</HTML>
So, in $a_var you have the cookie's value!!
Happy coding!
----- Original Message -----
From: "Stanley" <stanley@javacatz.com>
To: <php-windows@lists.php.net>
Sent: Wednesday, October 17, 2001 9:41 AM
Subject: Re: [PHP-WIN] setcookie
> Hi,
>
> thanks for your help!
> do you have the problem with IE (ver4 above)?
> i tried and cookie didn't capture by IE, but netscape can..
> any advise. thx!
>
> actually, i use setcookie in page1.php and will show the value in
> page2.php... for authentication
>
> pls help... thx a lot!
>
> Stanley
>
>
> "Robin Bolton" <sillyboy@mindless.com> wrote in message
> news:005101c156d5$0a94c7f0$a60f6c18@razero...
> > The problem is the second parameter has to be in double quotes.
> >
> > setcookie("TestCookie","$value",time()+3600);
> >
> > should fix the problem (tested and worked on mine).
> >
> > > -----Original Message-----
> > > From: Stanley [mailto:stanley@javacatz.com]
> > > Sent: October 16, 2001 9:36 PM
> > > To: php-windows@lists.php.net
> > > Subject: [PHP-WIN] setcookie
> > >
> > > Hi,
> > >
> > > can anyone tell me what's the correct procedure for setcookie..
> > > i already tried : setcookie ("TestCookie", $value,time()+3600);
> > > but it can't work...
> > >
> > > actually, i need to make the authentication page and the page should
> > have
> > > expiry function...
> > >
> > > pls help!.. thx!
> > >
> > > Stanley
> > >
> > >
> > >
> > > --
> > > PHP Windows Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> > > For additional commands, e-mail: php-windows-help@lists.php.net
> > > To contact the list administrators, e-mail:
> > php-list-admin@lists.php.net
> >
> >
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>