I just need to pass the form variable to the URL variable. I suspect this is something easy to do, but it's hard for me to find clear steps (these are not tons of code) on the Internet.
Here is my current form code
<form id="zip_search" method="post" action="dealers.php"> <label for="zipfield"><a href="dealers.php">Find a Dealer</a></label> <input name="tZip" type="text" id="zipfield" value="ZIP CODE" onblur="if(this.value=='') this.value='ZIP CODE';" onfocus="if(this.value=='ZIP CODE') this.value='';" /> <input type="image" value="Submit" class="submitbutton" src="/images/submit_button.gif" /> </form>
And all I need to do is send the browser to something like this:
http:
Thanks in advance for any help.
Refresh Question
Thanks Drew and Anton respond here to the update. Changing the login attribute to the name of the var (tZip to zip) URL along with changing the POST to GET did the trick, but for some reason it added two more additional URL variables (& x = 0 & y = 0). I assume that this is something wrong with my PHP code, since I am not a PHP master at any stage. Here is the whole code:
PHP function
<?php function processForm() { $zipCode = $_GET['zip']; $url = "dealers.php?zip=" . $zipCode; header("Location: $url"); exit; } ?>
The form
<form id="zip_search" method="get" action="dealers.php"> <label for="zipfield"><a href="dealers.php">Find a Dealer</a></label> <input name="zip" type="text" id="zipfield" value="ZIP CODE" onblur="if(this.value=='') this.value='ZIP CODE';" onfocus="if(this.value=='ZIP CODE') this.value='';" /> <input type="image" value="Submit" class="submitbutton" src="/images/submit_button.gif" /> </form>
URL output example
http:
Additional related question
How does it work if processForm () is defined but not called anywhere. It seems to me that the function processForm () should be in the action attribute in the opening form element. Any insight? Thanks in advance.
source share