Cookie problems
Posted: Wed Oct 09, 2002 5:11 am
I have a small HTML form that is used for searching. This sends the inputted data to a PHP script, using POST (Dont know if that is relevant).
What I want it to do is to record the string that I sent to search, and when someone goes to the search page again, it displays their last entered search.
I have got the script creating a cookie fine, but I am having troubles reading it back.
I am using:
to create the cookie (The 30055351 is a statically unique number to me). searchEntry is the field from the form. It is before the <html> tags 
Then in the html page, with the form I have
I am probably over looking something very obvious, but I just cant seem to get it to work.
I am using IE6, with Xitami (Windows, here) and Apache(Solaris, remote server).
Thanks for any help
What I want it to do is to record the string that I sent to search, and when someone goes to the search page again, it displays their last entered search.
I have got the script creating a cookie fine, but I am having troubles reading it back.
I am using:
Code: Select all
<?
$search = $_POSTї"searchEntry"];
setcookie("previousSearch", $search, time()+36000, "/30055351/");
?>Then in the html page, with the form I have
Code: Select all
<?
if (isset ($previousSearch)) {
echo "<p>" . $previousSearch . ": Your last search</p>";
}
else {
echo "<p>Welcome to this page for the first time.</p>";
}
?>I am using IE6, with Xitami (Windows, here) and Apache(Solaris, remote server).
Thanks for any help