note 88886 added to tutorial.forms
| From: | johnwu at osu1 dot php dot net | Date: | Thu, 12 Feb 2009 06:45:49 +0000 |
| Subject: | note 88886 added to tutorial.forms | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-150558@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.197
Probable Submitter: 202.60.235.218
----
Manual Page -- http://www.php.net/manual/en/tutorial.forms.php
Edit -- https://master.php.net/note/edit/88886
Del: integrated -- https://master.php.net/note/delete/88886/integrated
Del: useless -- https://master.php.net/note/delete/88886/useless
Del: bad code -- https://master.php.net/note/delete/88886/bad+code
Del: spam -- https://master.php.net/note/delete/88886/spam
Del: non-english -- https://master.php.net/note/delete/88886/non-english
Del: in docs -- https://master.php.net/note/delete/88886/in+docs
Del: other reasons-- https://master.php.net/note/delete/88886
Reject -- https://master.php.net/note/reject/88886
Search -- https://master.php.net/manage/user-notes.php