我正在为医院做一个系统,我目前正在处理的模块是病人账单的交易/计算。我在一个带有复选框的页面中列出了所有费用。提交时如何计算这些?
<?php
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "hmis";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Could not connect database");
mysql_select_db($mysql_database, $bd) or die("Could not select database");
$query = "SELECT * FROM charges";
$result = mysql_query($query);
echo "<font face=verdana><br><center><h2>ER CHARGES</h2></center>";
if(mysql_num_rows($result) > 0){
echo '<br><br><center><table border="1" cellspacing="3">
<tr>
<th>Pro.#</th>
<th>Procedure</th>
<th>Price</th>
<th></th>
</tr>
';
while($row = mysql_fetch_array($result)){
echo '
<tr>
<td>'.$row[0].'</td>
<td>'.$row[1].'</td>
<td>'.$row[2].'</td>
<td><input type="checkbox"></td>
</tr>
';
}
echo '</table>';
}else{
echo '<p style="color: red">Not found!</p>';
}
// ULTRASOUND
$query2 = "SELECT * FROM ultrasound";
$result2 = mysql_query($query2);
echo "<br><center><h2>ULTRASOUND CHARGES</h2></center>";
if(mysql_num_rows($result2) > 0){
echo '<br><br><center><font face=verdana><table border="1" cellspacing="3">
<tr>
<th>Pro.#</th>
<th>Procedure</th>
<th>Price</th>
<th></th>
</tr>
';
while($row = mysql_fetch_array($result2)){
echo '
<tr>
<td>'.$row[0].'</td>
<td>'.$row[1].'</td>
<td>'.$row[2].'</td>
<td><input type="checkbox"></td>
</tr>
';
}
echo '</table>';
}else{
echo '<p style="color: red">Not found!</p>';
}
// confinement
$query3 = "SELECT * FROM confinement";
$result3 = mysql_query($query3);
echo "<br><center><h2>CONFINEMENT CHARGES</h2></center>";
if(mysql_num_rows($result3) > 0){
echo '<br><br><center><font face=verdana><table border="1" cellspacing="3">
<tr>
<th>Pro.#</th>
<th>Procedure</th>
<th>Price</th>
<th></th>
</tr>
';
while($row = mysql_fetch_array($result3)){
echo '
<tr>
<td>'.$row[0].'</td>
<td>'.$row[1].'</td>
<td>'.$row[2].'</td>
<td><input type="checkbox"></td>
</tr>
';
}
echo '</table>';
}else{
echo '<p style="color: red">Not found!</p>';
}
echo '<br><input type="submit" name="submit">';
?>
我正在考虑让每个复选框都有值,但我觉得它行不通。