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>
</span>
<input name="zip" size="5" type="text" />
<input type="submit" value="GO" /> </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.
I had a very similar problem and changing the names as stated above fixed it...to a point. I thought it might be useful to include what was actually the issue. I had my variables being set backwards. I was resetting the $_POST variable with a blank value every time. I was trying to add the $_POST values to an array and had it thus:
$_POST['varname'] = $my_array['varname'];
Once I changed it to:
$my_array['varname'] = $_POST['varname'];
It worked perfectly. Hopefully my time spend staring at this silly mistake will save someone else from doing the same.
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:
Changed to:
And it worked fine. Thanks guys for your help!
I manually supplied
productid
as a GET parameter to yourzipfail.html
page. It's putting the value into the hidden input field just fine. It's also passing it toMini-zip-lookup.html
without flaw. It appears that either:productid
in the frame's url.zipfail.html
Make sure the iframe's url has
?productid=?<number>
on the end.You don't need to do that. Here is a better alternative