Form Submit Question...

Avalanche

New member
Jun 27, 2006
737
5
0
Form Submit Question - add zipcode to action url?

Been googling this one & none of the forum threads I've found have been able to help.

I have a one-page zip submit form on my server and want to take the zipcode and append it to the end of the URL it will redirect to upon submit. My LP designer gave me the following, but I really need to get it live & sometimes am not able to get a hold of him quickly. He said earlier to use a GET but not sure what to do w/ it.

the form code is...
Code:
<form action="[URL="http://www.mylink.com?var1=x&var2=y&zipcode=%28not"]http://www.mylink.com?var1=x&var2=y&zipcode=(not[/URL] sure what to put here)>
                    <p class="zipcode">
                        <input class="zipcode" type="text" value="Enter Zip Code..." onfocus="this.select();" />
                    </p>
                    <p class="center">
                        <input type="image" src="myimage.png" onmouseover="this.src='hoverimg.png'" onmouseout="this.src='anotherimage.png'" />
                    </p>
                </form>
 


Code:
<form action="yourpage.php" method="get">
<p class="zipcode">
<input class="zipcode" type="text" name="zip" value="Enter Zip Code..." onfocus="this.select();" />
</p>
<p class="center">
<input type="image" src="myimage.png" onmouseover="this.src='hoverimg.png'" onmouseout="this.src='anotherimage.png'" />
</p>
</form>

yourpage.php
PHP:
$zip = $_GET['zip'];
 
Well you might be able to do (not 100%)

Code:
<form action="hxxp://offerpage.com?var1=x&var2=y" method="get">
<p class="zipcode">
<input class="zipcode" type="text" name="zipcode" value="Enter Zip Code..." onfocus="this.select();" />
</p>
<p class="center">
<input type="image" src="myimage.png" onmouseover="this.src='hoverimg.png'" onmouseout="this.src='anotherimage.png'" />
</p>
</form>

but i would just do

Code:
<form action="mypage.php" method="get">
<p class="zipcode">
<input class="zipcode" type="text" name="zipcode" value="Enter Zip Code..." onfocus="this.select();" />
</p>
<p class="center">
<input type="image" src="myimage.png" onmouseover="this.src='hoverimg.png'" onmouseout="this.src='anotherimage.png'" />
</p>
</form>

and mypage.php =

PHP:
$zipcode=$_GET['zipcode'];
header('location:hxxp://offerpage.com?var1=x&var2=y&zipcode='.$zipcode);
 
I tried option #2 and on submit it throws this error

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/domains/mydomain.com/public_html/mypage.php:9) in /home/admin/domains/mydomain.com/public_html/mypage.php on line 15\


tried option #1 also - yeah, no dice.
 
mattfca was write with his option #1, you definitely don't need to do the option #2 method.

Code:
<form method="GET" action="http://notyoursite.com">
<input type="text" name="zip">
</form>

This will do what you want. It will result in the user going to a URL like Congratulations! Welcome to your new Web Site!

m
 
Gah, for some reason my posts are awaiting mod approval. Perhaps because I tried to use the code tag.

You don't need the 2nd option. The GET method in a form is exactly the same as appending parameters onto the end of a URL.

m
 
and if you need the extra variables for the submit page to work try:
Code:
<form method="GET" action="http://notyoursite.com/phpfile.php">
<input type="hidden" name="var1" value="x" />
<input type="hidden" name="var2" value="y" />
<input type="text" name="zip" />
<button type="submit">Click Here</button>
</form>
If you do it this way, it will look like the first GET that you posted w/
var1=x&var2=y&zip='user input'