At 3:10 PM +0100 8/28/09, Stuart wrote:
2009/8/28 Eric <blueray2...@yahoo.com>:
 > 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.

-Stuart


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.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to