I've got this form:
<form name="form1" method="POST" action="temp2.php">
<p>
<input name="shop[]" type="checkbox" id="contract" value="Contract|20">
contract £20 </p>
<p>
<input name="shop[]" type="checkbox" id="adtemplate" value="Ad Template|30">
ad template £30
</p>
<p>
<input type="submit" name="Submit" value="Add">
</p>
</form>
It sends the checkbox values as an array to the next page where I loop through and explode the array
<?php
foreach ($_POST['shop'] as $value)
{$a = explode('|', $value);
echo $a[0]. ": " . $a[1] . "<br>";
}
?>
This gives me:
Contract: 20
Ad Template: 30
What I'd like to do next is add the two figures together.
I thought something like array_sum() would work?
But I'm a bit stuck....