Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-10 Thread Ashley Sheridan
On Mon, 2009-08-10 at 15:40 -0300, Martin Scotta wrote: > This "intelligence" is given by the laziness of the && operator. > > $res = a() && b(); # if a() is false then b() does not evaluate > $res = a() & b(); # b() evaluates no matter a()'s result > > so, order matters. > > On Mon, Aug 10, 200

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-10 Thread Adam Randall
That should be !== not !=== Adam. On Mon, Aug 10, 2009 at 12:17 PM, Ralph Deffke wrote: > for the same story there are the -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

AW: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-10 Thread Ralph Deffke
he same story there are the == === and != !=== operators Von: Martin Scotta An: Andrew Ballard CC: Ralph Deffke ; php-gene...@lists..php.net Gesendet: Montag, den 10. August 2009, 20:40:19 Uhr Betreff: Re: [PHP] reason for a "Notice:.." on one site bu

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-10 Thread Martin Scotta
This "intelligence" is given by the laziness of the && operator. $res = a() && b(); # if a() is false then b() does not evaluate $res = a() & b(); # b() evaluates no matter a()'s result so, order matters. On Mon, Aug 10, 2009 at 3:29 PM, Andrew Ballard wrote: > On Mon, Aug 10, 2009 at 1:50 PM,

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-10 Thread Andrew Ballard
On Mon, Aug 10, 2009 at 1:50 PM, Ralph Deffke wrote: > this is not "intelligence" its just pure math. the '&&' says if BOTH > expressions are true then the whole expression is true. > > so if the first one is false, the whole is false, why checking the next one > in the underlaying C it would be so

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-10 Thread John Butler
If you switch it around you'll get a notice because the IF evaluates from left to right. So you just want to make sure you check isset() first. This would throw a notice: if($_POST['UserWishesDateRange'] == 'T' && isset($_POST['UserWishesDateRange'])) { Aha! That must be what I tried and

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-10 Thread Eddie Drapkin
On Mon, Aug 10, 2009 at 1:07 PM, Martin Scotta wrote: > Why do you all always use isset? > Why do you don't use array_key_exists instead? is it a more semantic > solution? > > > $key = 'UserWishesDateRange'; # just to make statement shorter > if( array_key_exists($key, $_POST ) && 'T' == $_POST[$k

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-10 Thread Ralph Deffke
this is not "intelligence" its just pure math. the '&&' says if BOTH expressions are true then the whole expression is true. so if the first one is false, the whole is false, why checking the next one in the underlaying C it would be something like this { if ( expression == false ) return false; i

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-10 Thread Martin Scotta
Why do you all always use isset? Why do you don't use array_key_exists instead? is it a more semantic solution? wrote: > >>> If you switch it around you'll get a notice because the IF evaluates >> from left to right. So you just want to make sure you check isset() >> first. >> >> This would thr

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-10 Thread John Butler
If you switch it around you'll get a notice because the IF evaluates from left to right. So you just want to make sure you check isset() first. This would throw a notice: if($_POST['UserWishesDateRange'] == 'T' && isset($_POST['UserWishesDateRange'])) { Aha! That must be what I tried a

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-10 Thread Shawn McKenzie
John Butler wrote: >> if(isset($_POST['UserWishesDateRange']) && $_POST['UserWishesDateRange'] >> == 'T') { > > > Thought I tried that. Apparently not exactly; it works now! Thanks. I > know it is clunky but I wanted to see how compact it could be done. If you switch it around you'll get a no

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-09 Thread John Butler
if(isset($_POST['UserWishesDateRange']) && $_POST['UserWishesDateRange'] == 'T') { Thought I tried that. Apparently not exactly; it works now! Thanks. I know it is clunky but I wanted to see how compact it could be done. -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-09 Thread Shawn McKenzie
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 befo

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-09 Thread John Butler
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. Th

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-09 Thread Phpster
On Aug 9, 2009, at 7:43 PM, John Butler wrote: Hi sunday coders, I've been using this kind of logic on one PHP site I work on to display one thing or another depending on whether the form was submitted or not: and it works great on that site. But on another site it still works

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-09 Thread Bastien Koert
Bastien Sent from my iPod -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-09 Thread Ben Dunlap
> But on another site it still works, but gives this error: > Notice: Undefined index: UserWishesDateRange in > /home/vs/site/phvs/bl/7solarsecrets/admin/trackingcode.html on line 79 > > I assume that is because the error display settings are set to a more > rigorous level in this latter site. > Is

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-09 Thread James Colannino
John Butler wrote: > if($_POST['UserWishesDateRange']) { //--line 79 > echo'submitted'; > } else { > echo'NOT submitted'; > } Try this instead: if (isset('UserWishesDateRange'])) { // [...stuff goes here...] } James -- "Black holes are where

Re: [PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-09 Thread Mari Masuda
On Aug 9, 2009, at 16:43, John Butler wrote: Hi sunday coders, I've been using this kind of logic on one PHP site I work on to display one thing or another depending on whether the form was submitted or not: if($_POST['UserWishesDateRange']) { //--line 79

[PHP] reason for a "Notice:.." on one site but not another? (Same code.)

2009-08-09 Thread John Butler
Hi sunday coders, I've been using this kind of logic on one PHP site I work on to display one thing or another depending on whether the form was submitted or not: if($_POST['UserWishesDateRange']) { //--line 79 echo'submitted'; } els