Skip to content
Advertisement

Hidden Input Values not being passed through form to New URL

I have a small html file working in the frame of a website. It currently requests a zip code and then calls a php page to query the database. The iframe gets the id number from the parent page and then gets the zip code from its own page. Here is the code snippet.

<script>
pid = window.location.search;
pid = pid.substring(11,16)
htmlout = '<input type = "hidden" name = "productid" id = "productid" value = "' + pid + '">';
</script>
<body style="margin: 0px; background-color: #ECECEC;">

<form action="https://www.net10wirelessphones.com/Mini-zip-Lookup.html" style="text-align: left" method = "get">
<script>
document.write(htmlout);
</script><span style="font-size: 9pt"><span style="font-family: Arial, Helvetica, sans-serif; color: #444444">Verify coverage in your area. Enter your Zip Code: 
</span>&nbsp;     
</span>
<input name="zip" size="5" type="text" />
<input type="submit" value="GO" />&nbsp;</form>

However, When I enter the zip code 00631, it only goes to the site http://www.net10wirelessphones.com/Mini-zip-Lookup.html?zip=00631

It seems to be cutting off the hidden value from the form. Any suggestions on what I may be doing wrong?

Edit: For those of you wanting to try it out, try it with the zip code 00631 and the product id 17637. It should accept this option and direct to the zipsuccess page.

Edit: Also, if you want to see it from the start go to the page https://www.net10wirelessphones.com/zipstart.html?productid=17637. Sorry I forgot to include it for those who have been trying it out.

Advertisement

Answer

I got the program to work. It turns out the problem was in another form that sent to this page. I had to make a slight change to a name attribute..

This:

<input name="id" id="productid" type="hidden" value="" />

Changed to:

 <input name="productid" type="hidden" id="productid" value="" />

And it worked fine. Thanks guys for your help!

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement