note 23543 deleted from function.setcookie by john
| From: | john@php.net | Date: | Sat, 30 Nov 2002 16:39:26 +0000 |
| Subject: | note 23543 deleted from function.setcookie by john | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-40178@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,