
Originally Posted by
tezzamatic
Hi,
I am developing a website that uses a hidden table in a form to pass data by post to the next (php) page. It uses the Javascript function (see below). I have used alert to check the variables delivery_cost and delivery_status are both as they should be. Also this works fine in Firefox but fails to pass the data in Internet Explorer.....any help / work around would be appreciated.
============================================================
function hidden_delivery(delivery_cost,delivery_status)
{
delornot.value = delivery_status;
delcost.value = delivery_cost;
}
============================================================
Thanks
Terry
Where have you declared what the delornot and delcost variables are?
If you have a form with an identifier:
HTML Code:
<form id="descriptiveidentifieraboutform" method="post" action="page2.php">
<input name="delornot" type="hidden">
<input name="delcost" type="hidden">
...
</form>
You can use the form to easily access the form elements within it. JavaScript has an elements property on forms which is used for that.
Code javascript:
function hidden_delivery(form, delivery_cost, delivery_status) {
form.elements.delornot.value = delivery_status;
form.elements.delcost.value = delivery_cost;
}
var form = document.getElementById('descriptiveidentifieraboutform'),
cost = ...,
status = ...;
hidden_delivery(form, cost, status);
Bookmarks