Results 1 to 3 of 3

Thread: PHP help

  1. #1
    Join Date
    Feb 2009
    Posts
    656
    Tokens
    0

    Default PHP help

    Hey can anyone help me on how to do this

    So I have a form and in another file I have a variable which is eg. 1000.. on my form there's a field to input a number and when the person puts a number in it tells them how many numbers until the total number (1000)

    How can I get it to echo to the person how much until the total?

    Thanks

  2. #2
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    PHP Code:
    <?php
    $number 
    1000;

    if(
    $_POST) {
        
    $user_number $_POST['number'];
        
    $difference $number $user_number;
        echo 
    "There are {$difference} numbers until {$number}.";
    } else {
        echo <<<HTML
        <form method="post">
            <label for="number"><strong>Number:</strong></label> <input type="text" name="number" />
            <input type="submit" value="Submit" />
        </form>
    HTML;
    }

  3. #3
    Join Date
    Feb 2009
    Posts
    656
    Tokens
    0

    Default

    Thanks

Posting Permissions

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