Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Check to see if $_POST is set, or is an array, and additionally, a popular method is to check the SUBMIT button's $_POST index to see if it's set and even if the value of it equals the submit button value on the html form.
Yes, check a particular value. I always go for the submission button. You can also check for the request method, though that does not guarentee that the values will be set.
_POST is however always available regardless of if it is a posted form, and will always be an array, so you cannot check for isset on post, or if is_array, though you can check for !empty. I'm fairly certain about this, I remember a previous CLI run on phpinfo(INFO_VARIABLES); pulled up an empty array from post. Everything actually, except for sessions.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Quote:
_POST is however always available regardless of if it is a posted form, and will always be an array, so you cannot check for isset on post, or if is_array