javascript乘法,加法和减法

时间:2016-11-26 19:36:01

标签: javascript php mysql html5

我正在尝试开发票,但我遇到了一些问题。我是如何使用javascript获取Amount,Subtotal和Return而不点击按钮的? 任何形式的帮助将不胜感激。 谢谢。 sample image

<?php

$sql = "SELECT * FROM product ORDER BY product_id DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        echo "<tr><td>" . $row["product"] . "\n<input type='checkbox' name='product[" . $row['product_id'] . "]' value=" . $row["product_id"] . "></td>";         

     echo "<td>Quantity\n\n<select name='quantity[" . $row['product_id'] . "]'>
        <option value='1'>1</option>
        <option value='2'>2</option>
        <option value='3'>3</option>
        <option value='4'>4</option>
        <option value='5'>5</option>
        <option value='6'>6</option>
        <option value='7'>7</option>
        <option value='8'>8</option>
        <option value='9'>9</option>
        <option value='10'>10</option>
    </select><br /></td>";

    echo "<td>Price <input type='text' name='price[" . $row['product_id'] . "]' value=" . $row["price"] . "></td>";
    echo "<td>Amount <input type='text' name='amount[" . $row['product_id'] . "]'></td>";
    echo "</tr>";

    }
 }

?>
</table>
<br />
<table>
<tr>
<td>Subtotal <input type="text" name="subtotal" size="10" /></td>
<td>Pay <input type="text" name="pay" size="10" /></td>
<td>Return <input type="text" name="return" size="10" /></td>
</tr>
</table>

0 个答案:

没有答案