I’m trying to make a simple budget form. What I need is that if some item is checked the system adds the price of these item (and if unchecked that item again substract it’s price of the total).
<form name="myform" method ='post'>
<input name="item" type="checkbox" value="flowers"/>
<input name="item" type="checkbox" value="animals"/>
</form>
And what I want is something like
if (item[1].checked) $total_price = $total_price + item[1];
And likewise
if (item[1].unchecked) $total_price = $total_price - item[1];
Here is a quick example of how you might implement the above. I have not tested it, but it is something to get started with.