new2everything
IS-IT--Management
I have a code to submit values from child page to the parent page but some of the inputs I take values from are conditional or repeat - defined by php and the values are not transferred. Please help, this is my code (the relevant bits):
Only the following are transferred: code and name.
I will really appreciate your help.
Code:
<head>
<script langauge="javascript">
function post_value(){
opener.document.new_item.new_supplier_id.value = document.product.supplier_id.value;
var contactElement = document.getElementById("suplier2_id");
if (contactElement != null)
{
opener.document.new_item.new_supplier2_id.value = document.product.supplier2_id.value;
}
var contactElement = document.getElementById("suplier_contact");
if (contactElement != null)
{
opener.document.new_item.new_supplier_contact.value = document.product.supplier_contact.value;
}
var contactElement = document.getElementById("suplier2_contact");
if (contactElement != null)
{
opener.document.new_item.new_supplier2_contact.value = document.product.supplier2_contact.value;
}
opener.document.new_item.new_product_code.value = document.product.code.value;
opener.document.new_item.new_product_name.value = document.product.name.value;
self.close();
}
</script>
</head
<body>
<form id="product" name="product" method="post" action="" style="margin-top:0; margin-bottom:0">
<input name="supplier_id" type="radio" value="<?php echo $supplier_id; ?>" />
<?php if ($supplier2_id) { ?><input name="supplier2_id" id="supplier2_id" type="text" value="<?php echo supplier2_id; ?>" /><?php } ?>
<?php
if ($row_rsContacts['ContactID']) {
do { ?>
<input name="supplier_contact" id="supplier_contact" type="radio" value="<?php echo ucwords($row_rsContacts['SupplierContactName']); ?>" />
<?php
} while ($row_rsContacts = mysql_fetch_assoc($rsContacts));
}
?>
<?php
if ($supplier2_id) {
if ($row_rsContacts2['ContactID']) {
do { ?>
<input name="supplier2_contact" id="supplier2_contact" type="radio" value="<?php echo ucwords($row_rsContacts2['SupplierContactName']); ?>" />
<?php
} while ($row_rsContacts2 = mysql_fetch_assoc($rsContacts2));
}
}
?>
<input name="code" type="hidden" value="<?php echo $row_rsProducts['ProductID']; ?>" />
<input name="name" type="hidden" value="<?php echo $row_rsProducts['ProductName']; ?>" />
<input type="button" value="Add Product" onclick="post_value();" />
</form>
</body>
Only the following are transferred: code and name.
I will really appreciate your help.