470,815 Members | 1,125 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Using PHP and Javasrcipt

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>

Jul 17 '05 #1
0 1171

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by rawCoder | last post: by
10 posts views Thread by Christopher Benson-Manica | last post: by
17 posts views Thread by beliavsky | last post: by
14 posts views Thread by john.burton.email | last post: by
5 posts views Thread by Enos Meroka | last post: by
12 posts views Thread by Calum Grant | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.