Re: form validation code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 30, 2010 at 09:07, David Mehler <dave.mehler@xxxxxxxxx> wrote:
> Hello,
> I've been looking at this to long, and am not seeing the issue. When i
> had the below php code set to !empty instead of !isset as it is now I
> got the value of the name variable echoed back, yet on sql insert that
> field, along with all others are empty, though no error is generated,
> just a bogus record is inserted.
> When I changed to !isset I'm now getting the die statement echoed as
> if no value was passed from the form. This is not the case, I filled
> it out completely.
> Can anyone tell me where this code went wrong?

    Sure.

> php Code:
> // Check if fields are isset
> echo "Field Checs.<br />";
> if (!isset($_POST['name'])) {

    .... the line above.

    (Hint: isset != empty)



    (Another hint: with !empty(), you told PHP, "if it's not empty."
Now, with !isset(), you're saying, "if it's not set.")




    (Answer: Remove the exclamation point from !isset().)


-- 
</Daniel P. Brown>
UNADVERTISED DEDICATED SERVER SPECIALS
SAME-DAY SETUP
Just ask me what we're offering today!
daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx
http://www.parasane.net/ || http://www.pilotpig.net/

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux