Re: HTTP_COOKIE_VARS and HTTP_POST_VARS problem
| From: | Ovidiu EFTIMIE | Date: | Wed, 04 Oct 2000 17:11:58 +0000 |
| Subject: | Re: HTTP_COOKIE_VARS and HTTP_POST_VARS problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-18606@lists.php.net to get a copy of this message | ||
I've also noticed something strange
When I call this code for the first time it sets the cookies and shows me
the values received by the GET method.
When I'm calling it again,to update the cookies, I have a weird thing going
on :
On the location bar I have the corect parameters sent from the form and on
the page I still have the old parameters from the cookies even if in the
script I'm calling HTTP_GET_VARS.
In fact the problem is that I cannot update the cookies.
if(!empty($HTTP_GET_VARS)){
while(list($k,$val)=each($HTTP_GET_VARS["nws"])){
setcookie("nws[".$k."]",$val,time()+86400,"/","mydomain.com");
}
reset($HTTP_GET_VARS["nws"]);
while(list($k,$val)=each($HTTP_GET_VARS["nws"])){
echo $k."=".$val."<br>";
}
exit;
//header("location:".$PHP_SELF);
}
In php.ini I have
variable_order=EGPCS
register_globals=on
track_vars=on
Any sugessions will be much apreciated.
Ovidiu
-----Mesaj original-----
De la: php-general-return-18590-eovidiu=rds.ro@lists.php.net
[mailto:php-general-return-18590-eovidiu=rds.ro@lists.php.net]În numele
Jason Lavigne
Trimis: Wednesday, October 04, 2000 3:41 AM
Catre: PHP List
Subiect: Re: [PHP] HTTP_COOKIE_VARS and HTTP_POST_VARS problem
First thing I noticed was the "mydomain.com", if you changed that for the
mail then sorry I do not know, but if you do have that in your script you
will get nothing back, use "/". Also I would suggest using sessions for this
(built-in in PHP 4).
Jay
----- Original Message -----
From: "Ovidiu EFTIMIE" <eovidiu@rds.ro>
To: "Php-General" <php-general@lists.php.net>
Sent: Wednesday, October 04, 2000 10:38 AM
Subject: [PHP] HTTP_COOKIE_VARS and HTTP_POST_VARS problem
> Hi,
> I am trying to use cookies but it seems that I don't fully understand
them.
> I have one page :
>
> if(isset($HTTP_POST_VARS["nws"])){
> while(list($k,$val)=each($HTTP_POST_VARS["nws"])){
>
> setcookie("nws[".$k."]",$val,time()+86400,"/","mydomain.com");
> }
> header("location:customizeNews.php");
> }
> else{
> if(isset($HTTP_COOKIE_VARS["nws"])){
> //show html with the listboxes on the current selection
> }else{
>
> //show html
> }
> }
> This page should show me a series of listboxes with options and it does
so.
> After I make my options the page is submited ($PHP_SELF) and this time I
> should have the same page with the same listboxes but with the options
> selected. This options are stored in a cookie. Well the problem is that if
I
> make my options, submit the page and then I try to change one or more
> options and resubmit the page I have the old options. The cookies are not
> updated.
> Anyone has any ideea? I'm using IE 5.0, but on Netscape 4.7 it does the
same
> thing.
>
>
> Thanx,
>
> Ovidiu
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net