I have a website which has a google search bar on the front page.
I implemented it like this:
<form action="http://www.google.com/search" name="googleform">
<input name=q value="" size=40>
</form>
Recently I wanted to make a sneaky little addition:
I wanted to make it so when the user enters a special password in that form box, it redirects them to a secret page.
I did it like this:
$arg = $_REQUEST['q'];
if ($_REQUEST['q']=="mypassword") echo "<meta http-equiv='refresh'
content='0; url=http://www.mysite.com/secretpage.html'>";
elseif ($_REQUEST['q']) echo "<meta http-equiv='refresh' content='0; url=http://www.google.com/search?hl=en&sugg ... off&q=$arg'>";
echo "<form action='http://www.mysite.com' name='googleform'>
<input name=q value='' size=40>
</form>";
My question:
This is functional but since it doesn't submit the google form the same way it won't parse things like calculator expressions or putting keywords of the search query in quotes.
Is there a way to use this META redirect scheme to forward the form to google the way my first form used to?
Using <META> to redirect a form
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Using <META> to redirect a form
You might want to look at the PHP function header(). See the manual.
(#10850)