Results 1 to 2 of 2

Thread: update value without refresing page

  1. #1
    27
    posts
    Registered User

    update value without refresing page

    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 Code:
      $one $value->getElementsByTagName("one");
            
    $_one $one ->item(0)->nodeValue
    My check boxes are declared as follows:
    HTML Code:
    <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 Code:
    if($_POST['one'] == 'YES')  
            {
                
    $subTotal $subTotal+$_one;
            } 
    but that didn't work, so then I tried:
    PHP Code:
    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?

  2. #2
    can only be done w/ javascript
    Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
    Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012