Re: How to read a cookie when path variable is different(Not default)
| From: | Richard Lynch | Date: | Thu, 07 Jul 2005 21:04:32 +0000 |
| Subject: | Re: How to read a cookie when path variable is different(Not default) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-218317@lists.php.net to get a copy of this message | ||
On Thu, July 7, 2005 10:34 am, Lenka, Bibhu Kalyan said:
> Hi, I am new to forum ,It may look as a simple problem, but I am not
> able to solve this.
> In following code , I have hard coded the path while setting cookie, now
> how I read it through PHP ?
>
> echo("cookie value name is : $name"); // this do not return anything.
I dunno why you'd want to use flaky, unreliable, complicated JavaScript to
set the cookie instead of http://php.net/setcookie but if the
JavaScript
worked in the first place, you'd have your cookie in:
$_COOKIE['name']
> Thanks,
> Bibhu
>
>
> <HTML>
> <HEAD>
> <TITLE>IWIN Search</TITLE>
> <script>
> function setCookie()
> {
>
> var expire = new Date();
> expire.setTime(expire.getTime() + 2592000000);
>
> document.cookie= "name= test; expires=" + expire.toGMTString() +
> ";domain=.schwab.com;path=/iwin2005";
> }
> </script>
> <body onLoad='setCookie()'>
> <?php
> echo("cookie value name is : $name");
> ?>
> </body>
>
>
--
Like Music?
http://l-i-e.com/artists.htm