Re: Problems with cookies....
| From: | Richard Lynch | Date: | Sun, 19 Aug 2001 03:38:13 +0000 |
| Subject: | Re: Problems with cookies.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-63337@lists.php.net to get a copy of this message | ||
> <?
> $pav='nustatymai.php';
> if ( $nustatymaslangas == 1 ) {
> setcookie("nustlangas", 1, time()+3600*24*30);
> } else {
> setcookie("nustlangas", 0, time()+3600*24*30);
> }
> if ( $nustatymaspastas == 1 ) {
> setcookie("nustpastas", 1, time()+3600*24*30);
> } else {
> setcookie("nustpastas", 0, time()+3600*24*30);
> }
> if ( $jau == 1 ){
> header("Location: main.htm");
> exit;
> }
>
> ?>
>
> <form action="<? echo $pav; ?>">
> <input type="hidden" name="jau" value="1">
> <SELECT name="nustatymaslangas">
> <option value="#">--- Pasirinkite ---</option>
> <option value="0">Same Window</option>
> <option value="1">New Window</option>
> </select>
>
> <SELECT name="nustatymaspastas">
> <option value="#">--- Choose ---</option>
> <option value="0">Same Window</option>
> <option value="1">New Window</option>
> </select>
> <input type="submit" value="Submit">
> </form>
Doing both SetCookie and Location header in the same script is problematic.
No matter which order you pick, some browsers will do the Location before
the SetCookie, and you have no Cookies set.
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm