Re: No COOKIE Set?
| From: | Aidan Lister | Date: | Thu, 01 Jan 2004 06:48:33 +0000 |
| Subject: | Re: No COOKIE Set? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173590@lists.php.net to get a copy of this message | ||
Try putting the exit() before the redirect, and see if there's an error when
you attempt to set the cookie.
"Cesar Aracena" <lists@icaam.com.ar> wrote in message
news:20040101060113.4223.qmail@pb1.pair.com...
> Hi all,
>
> My head is about to explode here... I am trying to setup a cookie for
every
> new user that registers in my site and right after that, to send them to
the
> home page... is that so difficult? apparently yes... It does redirect, but
> when I try to "echo" the $MemberId cookie with:
>
> echo $_COOKIE["MemberId"];
>
> Nothing happens... nothing is displayed... also, I can't find where these
> cookies are being stored. I am developing under WinXP, latest PHP and
latest
> MySQL... other cookies are being stored very well, but I don-t know
where...
> I'm displaying at http://localhost/..... ¿¿¿???
>
> Here's my script:
>
> if ($use_same_data == "yes") // One kind of information stored
> {
> $query = "INSERT INTO members_info ....... )";
> $result = mysql_query($query);
> $id = mysql_insert_id();
> }
>
> elseif ($use_same_data == "") // Other kind of choice of information
for
> shipping address
> {
> $query = "INSERT INTO members_info .......)";
> $result = mysql_query($query);
> $id = mysql_insert_id();
> }
>
> if (!$result)
> {
> echo "Error code here";
> }
> else
> {
> setcookie ("MemberId", $id, time()+31536000);
> header ("Location: $CFG->wwwroot");
> exit();
> }
>
> Thax in advanced,
>
> Cesar