Re: proper method to do the following...

From: Date: Wed, 06 Oct 2004 14:01:26 +0000
Subject: Re: proper method to do the following...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-198753@lists.php.net to get a copy of this message
On Wed, 6 Oct 2004 06:53:34 -0700 (PDT), Hugh Beaumont <hbeaumont@yahoo.com> wrote: > Notice: Undefined index: exact in search.php on line 10 > > code : > > if (!isset($_POST['exact'])) { <--------- line 10 > $_POST['exact'] == false; > } Reverse the logic of isset(). if (isset($_POST['exact'])) { $_POST['exact'] == TRUE; } If a variable is genuinely not set, it will produce the warning or notice you are seeing. There are a few ways to circumvent that: lower your error reporting level, or quiet the error with @, or reverse the logic so the error doesn't exist. I prefer the last method as I always use full error reporting during development. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/

« previous php.general (#198753) next »