At 3:10 PM +0100 8/28/09, Stuart wrote:
2009/8/28 Eric <>:
 > Here is another way

 if (isset($_POST['username'])  && $_POST['username'] != '')
 { ...

If you use this method then you'll completely ignore a form submission
if they've forgotten to enter a username. Detection and validation are
two distinct steps and should be treated as such.


I usually treat forms this way:

   $action = isset($_POST['action']) ? $_POST['action'] : null;

and then deal with $action.

Dealing with $action means that I might clean/scrub it for storage in MySQL, or use it to determine a course of processing, or any number of other things.

The point is to check IF a $_POST has occurred, without triggering an error if it hasn't, and to deal with the outcome either way.




PHP General Mailing List (
To unsubscribe, visit:

Reply via email to