Entry
How can I setup a form that counts the number of checkboxes the user selects, then multiplies that number times a dollar amount to achieve a total.
Mar 23rd, 2001 14:59
Ben Udall, Eric Thomas,
Here's a quick example:
<form action="process.php" method="post">
<input type="checkbox" name="cbox[]" value="1" />
<input type="checkbox" name="cbox[]" value="1" />
<input type="checkbox" name="cbox[]" value="1" />
</form>
In the form processing script (process.php):
<?
$amount = 6.50;
$total = count($cbox) * $amount;
echo 'Total: $'.$total;
?>