Okay, I'm displaying an entire table of numbers from my database.  Using a
form on the same page, you can enter an amount to add to the table and then
click submit.  I pass all of the information in $_POST back to the same
page.  Here is my code:


if ($_POST["number"] != NULL) {

    if (is_numeric($_POST["number"]) || $_POST["number"] <= 0.0){
        ...
        display stuff telling them they need to try again
        ...
    }
    else {
        ...
        do stuff that adds the number to the table
        ...

        $_POST["number"] = NULL;
    }
}

 ...body of HTML document...

<form method="POST" action="table.php">
<table border="0" cellpadding="5">
<tr>
<td align="right">Add Amount</td>
<td><input type="text" name="number"></td>
</tr>
<tr>
<td colspan=2><center><input type="submit" value="Click to
Submit"></center></td>
</tr>
</table>
</form>

Everything seems to work fine, up until you click the refresh button, then
it will add whatever you just added to the table again, even if you have
nothing typed into the form and dont hit the submit button.  So basically I
can add 500 by typing it in and clicking the submit button, then continue to
add an addition 500 every time I click the submit button.  I want to be able
to refresh the page, but I cant figure out what is going wrong.  Any ideas?

Rex

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to