while($row = mysql_fetch_array($result)){
echo '<tr>
<td>'.$row[0].'</td>
<td>'.$row[1].'</td>
<td>'.$row[2].'</td>';
$price=$row['price'];
echo "<td><input type='checkbox' name='er' value='$price'></td>";
echo "</tr>";
PHP file
<?php
$ercharge=$_POST['er'];
echo $ercharge;
?>
I have a list of charges that was from a mysql table and it has a checkbox for each item so it would compute the sum. The above code works and it outputs the price of the checked item. The problem is, it's only one item. When multiple items are checked, only one is outputted.