note 88886 deleted from tutorial.forms by danbrown
| From: | danbrown@php.net | Date: | Thu, 12 Feb 2009 22:31:56 +0000 |
| Subject: | note 88886 deleted from tutorial.forms by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150598@lists.php.net to get a copy of this message | ||
Note Submitter: john wu, HK
----
It's often useful to check whether a form is loaded for its first time. At that time, there
should be no data entered to form and therefore no processing should be carried out.
The following can do such checking:
if (empty($_POST))
exit (0);
...
...
If the array $_POST is empty, that means the form should be freshly loaded with no data entered yet.
After a user enters some data and submits the form, the array will become no longer empty and all
those lines of code coming after the if-statement will get executed this time.