If you want certain variables to over ride cookie variables you need to
change the setting of the variables_order directive in php.ini:

variables_order string
Set the order of the EGPCS (Environment, GET, POST, Cookie, Server) variable
parsing. The default setting of this directive is "EGPCS". Setting this to
"GP", for example, will cause PHP to completely ignore environment
variables, cookies and server variables, and to overwrite any GET method
variables with POST-method variables of the same name.

Fred

Richard S. Crawford <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Consider this code, in page1.php:

<?php
         setcookie("someWord","I am a cookie");
?>

...and this code, in page2.php:

<?php
         setcookie("someWord",$someWord);
         print ("someWord says: $someWord");
         $someWord = "I am a variable";
         print ("< a href=\"page2.php?someWord=$someWord\" >Click here< /a
>");
?>

(In the actual code, the value of $someWord is passed via POST through a
form, but the principle is the same.)

The first time I load page2.php, the output should be:

         someWord says: I am a cookie

Which, of course, works perfectly.

But each subsequent time I load page2.php, I want the output to be:

         someWord says: I am a variable

and then set the value of the cookie "someWord" to "I am a variable".

But that's not what happens.  Everytime I load page2.php, someWord tells me
that it is a cookie.

How do I get the value of the variable to override the value of the cookie?




Sliante,
Richard S. Crawford

http://www.mossroot.com
AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
MSN: [EMAIL PROTECTED]

"It is only with the heart that we see rightly; what is essential is
invisible to the eye."  --Antoine de Saint Exupéry

"Push the button, Max!"




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to