# Update value without refresing page

**URL:** https://forum.kirupa.com/t/update-value-without-refresing-page/299548
**Category:** Uncategorized
**Created:** [November 6, 2009, 3:18pm UTC](https://forum.kirupa.com/t/update-value-without-refresing-page/299548 "2009-11-06T15:18:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Gooo](https://avatars.discourse-cdn.com/v4/letter/g/eb8c5e/32.png) [@Gooo](https://forum.kirupa.com/u/Gooo)
#### Post date: [November 6, 2009, 3:18pm UTC](https://forum.kirupa.com/t/update-value-without-refresing-page/299548/1 "2009-11-06T15:18:42Z")

</div>

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.

```php
  $one = $value->getElementsByTagName("one");
        $_one = $one ->item(0)->nodeValue;

```

My check boxes are declared as follows:

```auto
<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:

```php
if($_POST['one'] == 'YES')  
        {
            $subTotal = $subTotal+$_one;
        }

```

but that didn’t work, so then I tried:

```php
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?
