Hi
I’ve got a few check boxes on my page, a calculate button and a place where I can display a subTotal. Each check box has a value that I’m getting from an xml document using DOM.
$one = $value->getElementsByTagName("one");
$_one = $one ->item(0)->nodeValue;
My check boxes are declared as follows:
<input type="checkbox" name="numbers" value="one" /> One
When the user clicks on a check box I want the subTotal to change accordingly. eg. if the subTotal was 100 and the user clicks on the check box that has a value of 200 then the subTotal must automatically change to 300.
I’ve tried to test if the check box is selected on the following way:
if($_POST['one'] == 'YES')
{
$subTotal = $subTotal+$_one;
}
but that didn’t work, so then I tried:
if (isset($_POST['one'])) {$subTotal = $subTotal+$_one;}
The problem with isset is that when I load the page the subTotal is 0 (which is correct) but without selecting any check box and then clicking the calculate button the subTotal changes to 200. Why would that be??
I’ve also tried to refresh the page after every 8 seconds so that the value can be calculated that way and stay updated with the check boxes selected, but that didn’t work either.
Is there any other way I can maybe try to update the subTotal?