Can I set the value of variable depending on when the page is loaded?
| From: | Don | Date: | Fri, 14 Jun 2002 02:35:41 +0000 |
| Subject: | Can I set the value of variable depending on when the page is loaded? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-102124@lists.php.net to get a copy of this message | ||
Hi,
I have a an HTML page containing a form used to search my website. The form has a drop-down menu
with two choices. When the submit button is clicked, I call a PHP page which look at the value of
the drop down menu selection and redirects to the appropriate form handler.
Basically, my PHP file creates a form called 'searchform' and creates it dynamically based
on the vale of my drop down menu field passed from the calling page.
I just use the following JavaScript to redirect:
echo "<script language=\"JavaScript\">\n";
echo "setTimeout('document.searchform.submit()',0);\n";
echo "</script>\n";
My problem is, when the user clicks the BACK button on their browser, it will just redirect back to
the search results page. I'd like it to take them back to the original page. I'm
thinking that if I could reset the value of the drop-down menu field, I can just use:
echo "<form name=\"searchform\" action=\"javascript:
history.back();\">\n";
But, how can I tell where the user is coming from?
I've seen these types of searches before so maybe someone can clue me in?
Thanks,
Don