Re: Reload page after form submit
| From: | brian | Date: | Sat, 01 Sep 2007 00:18:46 +0000 |
| Subject: | Re: Reload page after form submit | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261577@lists.php.net to get a copy of this message | ||
Afan Pasalic wrote:
brian wrote:<?php if (isset($_POST)) {The problem that i see is here: if (isset($_POST)) This will always return TRUE. It should rather be: if (isset($_POST['name_of_your_submit_btn'])) or some other form element, at least. I don't know if this was simply because it was a rough draft of the code or even if it's the cause of the problem (which i still don't quite understand) but, anyway ... briannope. ONLY when form with method POST is submitted. if you open the page first time "else" block will be executed. though, I agree it's much better to have if(isset($_POST['SubmitForm']) and $_POST['SubmitForm'] == 'Submit') where <input type=Submit name=SubmitForm value="Submit"> but, as I said earlier, it's not the code, just an idea.
print('What did i tell you?');
}
?>