Skip to content Skip to sidebar Skip to footer

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 t

Solution 1:

You don't need to do that. Here is a better alternative

<script>
pid = window.location.search;
pid = pid.substring(11,16)

//here is the changes
document.getElementById("productid").value = pid;
</script>

<form action="https://www.net10wirelessphones.com/Mini-zip-Lookup.html" style="text-align: left" method = "get">
<input type = "hidden" name = "productid" id = "productid" value = "" />

<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>

Solution 2:

I manually supplied productid as a GET parameter to your zipfail.html page. It's putting the value into the hidden input field just fine. It's also passing it to Mini-zip-lookup.html without flaw. It appears that either:

  1. You're not be providing the productid in the frame's url.
  2. Or the relevant code on that page is different from zipfail.html

Make sure the iframe's url has ?productid=?<number> on the end.


Solution 3:

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!


Solution 4:

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.


Post a Comment for "Hidden Input Values Not Being Passed Through Form To New URL"