【发布时间】:2013-07-31 09:36:54
【问题描述】:
我有一个显示 MySQL 查询结果的 PHP 页面。
用户可以更改预期输入的数量,点击Get Total按钮,用户可以看到Item Rate * Qty Intended的结果。因此,total 可用于为用户创建凭证。
谁能指导我如何将此功能添加到我现有的页面。
我的代码目前如下所示:
<?php
include 'functions.php'; //for connection
?>
<table>
<tr>
<th>Select</font></th>
<th>Item Desc</th>
<th>Item Specification</th>
<th>Item Rate</th>
<th>Qty Intented</th>
</tr>
<?php
$sql1 = mysql_query("SELECT * from item
where item ='stationeries'")
while ($row = mysql_fetch_array($sql1, MYSQL_ASSOC)) {
?>
<tr>
<td><input type="checkbox" name="sel" /></td>
<td><?php echo $row['item']; ?></td>
<td><?php echo $row['specification']; ?></td>
<td><?php echo $row['rate']; ?></td>
<td><input type="text" name="qty" class="toAdd" id="qty" value="0.0" /></td>
</tr>
<?php
}
?>
</table><br />
<input type="button" value="Get Total" />
<input type="text" id="total" />
【问题讨论】:
-
您需要使用 javascript 将两个值相乘并放在第三个元素上
-
您希望有人指导您或为您编写代码?因为这真的是基本的 javascript...
标签: php javascript jquery mysql