note 23543 added to function.setcookie

From: Date: Sun, 21 Jul 2002 19:09:34 +0000
Subject: note 23543 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-33367@lists.php.net to get a copy of this message
Hello, New to php. I been looking every where and can't seem to find the answer. I have 2 computers. 1 with apache 1.3 and php 4.1. The other with apache 2 anf php 4.2. The probelm I have is when I set a cookie on apach 2 with php 4.2 I can only seem to set 1 variable to the cookie. If I set another cookie and variable it over writes everything and only leaves the last variable writen to the cookie. <?php if(isset($f_name)) { setcookie("f_name",$f_name, time() + 365 * 86400); if(isset($date)) { $old_date = $date; } else { $old_date = date("l F j, Y"); } $date = date("l F j, Y"); setcookie("date", $date, time() + 365 * 86400); } ?> <html> <head> <title>The Cookie Script</title> </head> <body> <?php if(isset($f_name)) { echo "<h3>Welcome back to the page $f_name!"; echo "<br>You were last here on $old_date.</h3>"; } else { echo "<form action=\"cookie.php\" method=\"POST\">"; echo "Tell us your First Name: <input type=\"text\" name=\"f_name\">"; echo "<input type=\"submit\" name=\"submit\" value=\"Submit\">"; echo "</form>"; } ?> </body> </html> From the code above it works fine on my computer with apache 1.3 and php 4.1. The form asks for a user name and then calls its self. The cookie is set with both variable $f_name and $date, but on my apache 2 and php 4.2 computer the cookie only writes the $date variable. I checked my php.ini file and the only difference is variables_order is set to EGPCS. If anyone could help? Thank you, -- http://www.php.net/manual/en/function.setcookie.php http://master.php.net/manage/user-notes.php?action=edit+23543 http://master.php.net/manage/user-notes.php?action=delete+23543 http://master.php.net/manage/user-notes.php?action=reject+23543

« previous php.notes (#33367) next »