RE: [PHP] help ... isset() don't work on posted variables...
| From: | John W. Holmes | Date: | Mon, 14 Apr 2003 01:58:21 +0000 |
| Subject: | RE: [PHP] help ... isset() don't work on posted variables... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143703@lists.php.net to get a copy of this message | ||
> To try and determine if the required fields have been filled in, I'm
using
> isset() ... but apparently I'm doing it wrong, 'cause it ain't
working. My
> other post pages just load the variables from the post vars (without
> testing if they're set), and then test if they're blank. This works
fine,
> but to make the code on this page simpler (because it's gonna be far
more
> complex in the end), I wanna use isset() ... but for the life of me I
> cannot get it working...
Use empty(), not isset(). Text boxes will always be set (isset will be
TRUE) whether a value was typed in them or not.
if(empty($_POST['name'])) { $error = "You did not give a name."; }
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/