Hi,
I've been asked by a client to design what is essentially a very large
order form which draw it's products from a MySQL db using PHP and then
writes them to a table, this i'm fine with.
However, the form must add up quantities and work out discounts based
on the base price and quantity, again, i'm ok with this in either
Javascript or PHP.
However, as this information is dynamically sourced and all of the
different fields need naming, i'm a little lossed as to how i can best
do this.
Does anyone have any suggesstions?
Client Side Code is included below: -
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="JavaScript">
function Total( evt )
{
total.innerText = parseInt(document.orderform.amount1.value) *
parseInt(document.orderform.amount2.value);
}
</script>
</head>
<body>
<form name="orderform" id="orderform">
<table align="center" border="1" width="770px" cellspacing="0"
cellpadding="0" bordercolor="#000000">
<tr>
<td>Product Code</td>
<td>Product Description</td>
<td>QTY</td>
<td>Price</td>
</tr>
<tr>
<td>ProdCodeOne</td>
<td>Product One</td>
<td><input type="hidden" name="amount1" value="15.4" />
<input type="text" name="amount2" onKeyUp="Total( event )" size="1"
value="0"></td>
<td>20</td>
<td><span id="total"></span>
</table>
</body>
</html>