Re: reason for a "Notice:.." on one site but not another? (Same code.)
| From: | Shawn McKenzie | Date: | Mon, 10 Aug 2009 02:36:54 +0000 |
| Subject: | Re: reason for a "Notice:.." on one site but not another? (Same code.) | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-296539@lists.php.net to get a copy of this message | ||
John Butler wrote:
>>
>> http://us3.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
>>
>
> Thank you guys for the isset() heads up. And Ben, for this good
> explanation of error reporting!
>
>> As others have pointed out, it's a good idea to call isset() on a
>> POST-variable before trying to get at its value. This will avoid a
>> notice being thrown.
>
> OK, and I can work around all this anyway, but I would love to get it
> all in one line of code, that essentially says: (pseudocode)
> if ($IamNotEmpty && $IamEqualto='T') {
> (where those are both the same var)
if(isset($_POST['UserWishesDateRange']) && $_POST['UserWishesDateRange']
== 'T') {
-- or --
$uwdr = $_POST['UserWishesDateRange'];
if(isset($uwdr) && $uwdr == 'T') {
--
Thanks!
-Shawn
http://www.spidean.com