> -----Original Message-----
> From: paras...@gmail.com [mailto:paras...@gmail.com] On Behalf Of
> Daniel P. Brown
> Sent: 12 August 2011 16:53
> 
> On Fri, Aug 12, 2011 at 11:42, Chris Stinemetz
> <chrisstinem...@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
> }
> 
> ?>

The last part of that test is redundant, since if $_POST['market'] is
NULL isset($_POST['market'] will be FALSE.


Cheers!

Mike

-- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Portland PD507, City Campus, Leeds Metropolitan University,
Portland Way, LEEDS,  LS1 3HE,  United Kingdom 
E: m.f...@leedsmet.ac.uk     T: +44 113 812 4730





To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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

Reply via email to