note 47150 added to tutorial.forms
| From: | kd dot SP*AM at SP*AM dot downsfam dot net | Date: | Thu, 04 Nov 2004 14:56:13 +0000 |
| Subject: | note 47150 added to tutorial.forms | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-79611@lists.php.net to get a copy of this message | ||
You may wish to know if a request for a PHP file came as a result of a POST or as a normal request.
Usually the first time a user brings up a form there is no POST data and on most subsequent trips
there is POST data.
You can determine if there is POST data by using the ISSET() function of any particular post
variable, as in:
<?php
if (isset($_POST['any_form_variable'])) {
statement;
}
?>
To make it generic, put a hidden input onto your forms, and always use the same name, such as:
<form....
<input type="hidden" name="post_trap" value="x">
<?php
if (isset($_POST['post_trap'])) {
statement;
}
?>
</form>
----
Manual Page -- http://www.php.net/manual/en/tutorial.forms.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47150
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47150&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47150&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47150&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47150&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47150&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47150&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47150&report=yes
Search -- http://master.php.net/manage/user-notes.php