Re: form validation
| From: | Daniel P. Brown | Date: | Fri, 12 Aug 2011 15:52:47 +0000 |
| Subject: | Re: form validation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-314514@lists.php.net to get a copy of this message | ||
On Fri, Aug 12, 2011 at 11:42, Chris Stinemetz <chrisstinemetz@gmail.com> wrote:
> I have a select menu created by a foreach loop. I am trying to
> validate that there was a selection made before it is submitted to the
> database. But I am not doing something correctly.
Try using a combination of isset, empty, and is_null() instead:
<?php
if (!isset($_POST['market']) || empty($_POST['market']) ||
is_null($_POST['market'])) {
// Wasn't set
}
?>
--
</Daniel P. Brown>
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/