I have the form below, each field is in a table cell.
When I select cash/check/credit card in the dropdown box payment method, it changes the contents of the next cell to either be a hidden field for cash, a text field for check number, or another dropdown box to select credit card type.
No matter which is selected, the name of the form field is "payinfo"
Unfortunately, when I click submit, every field but payinfo is being sent to my php script.
When I select cash/check/credit card in the dropdown box payment method, it changes the contents of the next cell to either be a hidden field for cash, a text field for check number, or another dropdown box to select credit card type.
No matter which is selected, the name of the form field is "payinfo"
Unfortunately, when I click submit, every field but payinfo is being sent to my php script.
Code:
<table cellpadding="5" style="border:1px solid black;border-collapse:collapse;"> <form name="form1" id="form1" method="post" autocomplete="off" action="http://bytes.com/payment.php?do=pay"> <script type="text/javascript">
function settd (paytype) {
if (paytype == "cash") {
document.getElementById('payinf').innerHTML = 'Cash<input type="hidden" name="payinfo" value="cash">';
}
if (paytype == "check") {
document.getElementById('payinf').innerHTML = 'Check Number:<input type="text" name="payinfo" size=6>';
}
if (paytype == "credit") {
document.getElementById('payinf').innerHTML = 'Card Type:<select name="payinfo"><option></option><option value="VISA">Visa</option><option value="MC">Master Card</option><option value="AX">American Express</option><option value="DC">Discover</option></select>';
}
}
</script> <tr><td style="border:1px solid black;">Select Company:</td><td style="border:1px solid black;">Invoice/RA:</td><td style="border:1px solid black;">Payment Method</td><td style="border:1px solid black;">Payment Info</td><td style="border:1px solid black;">Amount</td><td>Notes</td><td></td></tr> <tr><td style="border:1px solid black;"><select name="company"><option></option><option value="c1">company 1</option> <option value="c2">company 2</option> <option value="c3">company 3</option> </select> </td> <td style="border:1px solid black;"><input type="text" size="5" name="invoice"></td> <td style="border:1px solid black;"><select name="method" ONCHANGE="settd(this.options[this.selectedIndex].value);"> <option></option> <option value="cash">Cash</option> <option value="check">Check</option> <option value="credit">Credit Card</option> </select></td> <td style="border:1px solid black;" id="payinf">Select Payment Type</td> <td style="border:1px solid black;"><input type="text" name="amount" size="5" value=""></td> <td style="border:1px solid black;"><input type="text" name="notes" size="10"></td> <td><input type="submit" value="Add Payment"></tr></table><br><br>
Comment