Jump to content

mltgroup

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by mltgroup

  1. If you're looking to have it automatically add up without a page refresh or submit button clicked you'd need to use Javascript & AJAX.

     

    Otherwise your form could look like this:

    <form method="post" action="index.php">
    <input type="text" name="field_1" /> First Number<br />
    <input type="text" name="field_2" /> Second Number<br />
    <input type="submit" />
    </form>
    

     

    on the index.php file in the header you would do this:

    <?php
    
    $val = $_POST['field_1'] + $_POST['field_2'];
    echo $val;
    
    ?>
    

×
×
  • Create New...