Re: [PHP] isset empty or ...?

2013-03-31 Thread Александр Меньщиков
http://www.php.net/manual/en/types.comparisons.php Maybe first table PHP functions comparison (including 'isset' and 'empty') could help you. 31.03.2013 в 8:53, John Taylor-Johnston написал(а): I'm using if($mydata-DPRresponselocationaddress1 != ) is this the same as if

[PHP] isset empty or ...?

2013-03-30 Thread John Taylor-Johnston
I'm using if($mydata-DPRresponselocationaddress1 != ) is this the same as if (!isset($mydata-DPRresponselocationaddress)) http://php.net/manual/en/function.isset.php or if (!empty($mydata-DPRresponselocationaddress)) http://php.net/manual/en/function.empty.php or is there another function I

[PHP] isset not functioning

2009-08-03 Thread Allen McCabe
I created a simple survey for my work website, most of the PHP is on my process.php document, which is referenced by a form on a seperate page containing the form with the method of post. On my process.php page, the script obtains the field data using the $_REQUEST[] function. I have a small if

Re: [PHP] isset not functioning

2009-08-03 Thread Andrew Ballard
On Mon, Aug 3, 2009 at 1:08 PM, Allen McCabeallenmcc...@gmail.com wrote: I created a simple survey for my work website, most of the PHP is on my process.php document, which is referenced by a form on a seperate page containing the form with the method of post. On my process.php page, the

Re: [PHP] isset not functioning

2009-08-03 Thread Parham Doustdar
Your if-statement should be like this: [code] if(isset($_REQUEST['firstname']) !empty($_REQUEST['firstname'])) { ... } [/code] -- --- Contact info: Skype: parham-d MSN: fire_lizard16 at hotmail dot com email: parham90 at GMail dot com Allen McCabe allenmcc...@gmail.com wrote in message

Re: [PHP] isset not functioning

2009-08-03 Thread Ollisso
On Mon, 03 Aug 2009 20:11:44 +0300, Parham Doustdar parha...@gmail.com wrote: Your if-statement should be like this: [code] if(isset($_REQUEST['firstname']) !empty($_REQUEST['firstname'])) { ... } [/code] Or even: [code] if(!empty($_REQUEST['firstname'])) { ... } [/code] Because empty

Re: [PHP] isset not functioning -RESOLVED

2009-08-03 Thread Allen McCabe
Thanks! On Mon, Aug 3, 2009 at 10:13 AM, Andrew Ballard aball...@gmail.com wrote: On Mon, Aug 3, 2009 at 1:08 PM, Allen McCabeallenmcc...@gmail.com wrote: I created a simple survey for my work website, most of the PHP is on my process.php document, which is referenced by a form on a

Re: [PHP] isset not functioning

2009-08-03 Thread Steve Brown
if(isset($_REQUEST['firstname']) !empty($RESULT['firstname'])) {  $name = $_REQUEST['firstname'];  } else {  $name = 'Sir or Madam'; } Can anyone see any problems with the code? Your conditional will never evaluate to true. What is $RESULT? Where did it come from? $RESULT is not a

RE: [PHP] isset not functioning

2009-08-03 Thread Yuri Yarlei
: php-general@lists.php.net Subject: [PHP] isset not functioning I created a simple survey for my work website, most of the PHP is on my process.php document, which is referenced by a form on a seperate page containing the form with the method of post. On my process.php page, the script obtains

RE: [PHP] isset question

2009-06-22 Thread Ford, Mike
On 19 June 2009 19:53, Ashley Sheridan advised: On Fri, 2009-06-19 at 12:36 +0100, Ford, Mike wrote: On 18 June 2009 20:25, LAMP advised: using !empty() instead isset() will work if you don't care for PHP Notice: Undefined variable... If you want to avoid PHP Notice you have to use both:

Re: [PHP] isset question

2009-06-21 Thread Gary
How does echoing back to the page make it vulnerable? This does not go to a DB if that makes any difference. Gary Paul M Foster pa...@quillandmouse.com wrote in message news:20090621032151.gb14...@quillandmouse.com... On Sat, Jun 20, 2009 at 12:20:56PM +0100, Ashley Sheridan wrote: On Sat,

Re: [PHP] isset question

2009-06-21 Thread Ashley Sheridan
On Sun, 2009-06-21 at 13:57 -0400, Gary wrote: How does echoing back to the page make it vulnerable? This does not go to a DB if that makes any difference. Gary Paul M Foster pa...@quillandmouse.com wrote in message news:20090621032151.gb14...@quillandmouse.com... On Sat, Jun 20,

Re: [PHP] isset question

2009-06-20 Thread Ashley Sheridan
On Sat, 2009-06-20 at 00:19 -0400, Paul M Foster wrote: On Fri, Jun 19, 2009 at 07:52:40PM +0100, Ashley Sheridan wrote: On Fri, 2009-06-19 at 12:36 +0100, Ford, Mike wrote: On 18 June 2009 20:25, LAMP advised: using !empty() instead isset() will work if you don't care for PHP

Re: [PHP] isset question

2009-06-20 Thread Reese
Waynn Lue wrote: I notice that you're checking $_POST['mort'] but you're echoing $mort, is that your actual code? That was my observation as well. Is $mort = $POST['mort']; being set somewhere else or not? If not, how is your script supposed to know what value $mort should be? And, what the

Re: [PHP] isset question

2009-06-20 Thread Gary
Yes... I echo the code onto the page as well as sending out the message. The echo is sort of a thank you page, this is what you submitted. A message, which is not going into a DB, is also emailed to the submitter and cleint. Gary Waynn Lue waynn...@gmail.com wrote in message

Re: [PHP] isset question

2009-06-20 Thread Paul M Foster
On Sat, Jun 20, 2009 at 12:20:56PM +0100, Ashley Sheridan wrote: On Sat, 2009-06-20 at 00:19 -0400, Paul M Foster wrote: On Fri, Jun 19, 2009 at 07:52:40PM +0100, Ashley Sheridan wrote: On Fri, 2009-06-19 at 12:36 +0100, Ford, Mike wrote: On 18 June 2009 20:25, LAMP advised:

RE: [PHP] isset question

2009-06-19 Thread Ford, Mike
On 18 June 2009 20:25, LAMP advised: using !empty() instead isset() will work if you don't care for PHP Notice: Undefined variable... If you want to avoid PHP Notice you have to use both: $msg.= (isset($_POST['mort']) and !empty($_POST['mort'])) ? The mortgage amount is $mort\n : ;

RE: [PHP] isset question

2009-06-19 Thread Ashley Sheridan
On Fri, 2009-06-19 at 12:36 +0100, Ford, Mike wrote: On 18 June 2009 20:25, LAMP advised: using !empty() instead isset() will work if you don't care for PHP Notice: Undefined variable... If you want to avoid PHP Notice you have to use both: $msg.= (isset($_POST['mort']) and

Re: [PHP] isset question

2009-06-19 Thread Paul M Foster
On Fri, Jun 19, 2009 at 07:52:40PM +0100, Ashley Sheridan wrote: On Fri, 2009-06-19 at 12:36 +0100, Ford, Mike wrote: On 18 June 2009 20:25, LAMP advised: using !empty() instead isset() will work if you don't care for PHP Notice: Undefined variable... If you want to avoid PHP Notice

[PHP] isset question

2009-06-18 Thread Gary
I have a form that gives the submitter a choice or either one set of questions, or another. I am still getting the message even if the input was left blank. So on the line below, $msg.= isset($_POST['mort']) ? The mortgage amount is $mort\n : ; I get The mortgage amount is What am I

Re: [PHP] isset question

2009-06-18 Thread Stuart
2009/6/18 Gary gwp...@ptd.net: I have a form that gives the submitter a choice or either one set of questions, or another. I am still getting the message even if the input was left blank.  So on the line below, $msg.=  isset($_POST['mort']) ? The mortgage amount is  $mort\n : ; I get The

Re: [PHP] isset question

2009-06-18 Thread Steve
Use !empty($_POST['mort']) instead of isset() for form input since the form will still set an empty value if left blank. Gary wrote: I have a form that gives the submitter a choice or either one set of questions, or another. I am still getting the message even if the input was left blank. So

Re: [PHP] isset question

2009-06-18 Thread LAMP
Steve wrote: Use !empty($_POST['mort']) instead of isset() for form input since the form will still set an empty value if left blank. Gary wrote: I have a form that gives the submitter a choice or either one set of questions, or another. I am still getting the message even if the input was

Re: [PHP] isset question

2009-06-18 Thread Waynn Lue
I notice that you're checking $_POST['mort'] but you're echoing $mort, is that your actual code? On 6/18/09, Gary gwp...@ptd.net wrote: I have a form that gives the submitter a choice or either one set of questions, or another. I am still getting the message even if the input was left blank.

RE: [PHP] isset question

2009-06-18 Thread Yuri Yarlei
Java, after the world. Kyou wa PHP, ashita wa Java, sono ato sekai desu. Date: Thu, 18 Jun 2009 20:07:09 +0100 From: stut...@gmail.com To: gwp...@ptd.net CC: php-general@lists.php.net Subject: Re: [PHP] isset question 2009/6/18 Gary gwp...@ptd.net: I have a form that gives the submitter

[PHP] isset($a-b) even if $a-b = null

2007-08-17 Thread Olav Mørkrid
how do i test if a property of a stdclass object is set, even if its value is null, similar to how array_key_exists() works for arrays. the following method fails: $a-b = null; if(isset($a-b)) echo yes; and property_exists() seems only to work for defined objects. hope someone can

Re: [PHP] isset($a-b) even if $a-b = null

2007-08-17 Thread Borokov Smith
Olav Mørkrid schreef: how do i test if a property of a stdclass object is set, even if its value is null, similar to how array_key_exists() works for arrays. the following method fails: $a-b = null; if(isset($a-b)) echo yes; and property_exists() seems only to work for defined

Re: [PHP] isset($a-b) even if $a-b = null

2007-08-17 Thread Michael Preslar
On 8/17/07, Olav Mørkrid [EMAIL PROTECTED] wrote: how do i test if a property of a stdclass object is set, even if its value is null, similar to how array_key_exists() works for arrays. the following method fails: $a-b = null; if(isset($a-b)) echo yes; and property_exists() seems

[PHP] Isset Errors

2007-05-09 Thread Davide Bernard
Anyone got any suggestions on getting rid of these errors below? [Wed May 09 08:59:05 2007] [error] [client 192.168.225.246] PHP Notice: Undefined index: userstate in /srv/www/htdocs/resetpw.php on line 31, referer: https://ams.unt.edu/resetpw.php [Wed May 09 08:59:05 2007] [error] [client

RE: [PHP] Isset Errors

2007-05-09 Thread Edward Kay
-Original Message- From: Davide Bernard [mailto:[EMAIL PROTECTED] Sent: 09 May 2007 15:18 To: php-general@lists.php.net Subject: [PHP] Isset Errors Anyone got any suggestions on getting rid of these errors below? [Wed May 09 08:59:05 2007] [error] [client 192.168.225.246

Re: [PHP] Isset Errors

2007-05-09 Thread Richard Lynch
On Wed, May 9, 2007 9:17 am, Davide Bernard wrote: Anyone got any suggestions on getting rid of these errors below? [Wed May 09 08:59:05 2007] [error] [client 192.168.225.246] PHP Notice: Undefined index: userstate in /srv/www/htdocs/resetpw.php on line 31, referer:

Re: [PHP] isset

2007-04-18 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-04-17 13:59:39 +0200: snip The count is maintained internally as items are added/removed, and it is an O(1) operation for PHP to count the array, as it already knows the answer and just returns it. /snip Hi nothing to do with the actual topic, i am

RE: [PHP] isset

2007-04-17 Thread Tim
snip The count is maintained internally as items are added/removed, and it is an O(1) operation for PHP to count the array, as it already knows the answer and just returns it. /snip Hi nothing to do with the actual topic, i am just wondering how you get this internals information

Re: [PHP] isset

2007-04-17 Thread Stut
Tim wrote: snip The count is maintained internally as items are added/removed, and it is an O(1) operation for PHP to count the array, as it already knows the answer and just returns it. /snip Hi nothing to do with the actual topic, i am just wondering how you get this internals

Re: [PHP] isset

2007-04-17 Thread Robert Cummings
On Tue, 2007-04-17 at 13:14 +0100, Stut wrote: Tim wrote: snip The count is maintained internally as items are added/removed, and it is an O(1) operation for PHP to count the array, as it already knows the answer and just returns it. /snip Hi nothing to do with the actual

RE: [PHP] isset

2007-04-17 Thread Richard Lynch
On Tue, April 17, 2007 6:59 am, Tim wrote: snip The count is maintained internally as items are added/removed, and it is an O(1) operation for PHP to count the array, as it already knows the answer and just returns it. /snip Hi nothing to do with the actual topic, i am just wondering

Re: [PHP] isset

2007-04-17 Thread Richard Lynch
On Mon, April 16, 2007 8:06 pm, Robert Cummings wrote: On Mon, 2007-04-16 at 19:05 -0500, Richard Lynch wrote: On Mon, April 16, 2007 6:10 pm, Jochem Maas wrote: if I know it's an array I'll definitely use empty() over count() count() needs to actually count the items where as empty()

Re: [PHP] isset

2007-04-16 Thread tedd
At 12:16 PM -0500 4/15/07, Larry Garfield wrote: If you want your syntax to be a bit simpler, I frequently use helper functions along these lines: function http_get_int($var, $default=0) { return isset($_GET[$var]) ? (int) $_GET[$var] : $default; } if (http_get_int('var') ==5) { // Do

Re: [PHP] isset

2007-04-16 Thread Jim Lucas
Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] = and isset thinks is set I use this combination a lot: if (

Re: [PHP] isset

2007-04-16 Thread Stut
Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] = and isset thinks is set I use this combination a lot: if (

Re: [PHP] isset

2007-04-16 Thread Jim Lucas
Robert Cummings wrote: On Mon, 2007-04-16 at 09:27 -0700, Jim Lucas wrote: Stut wrote: Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set.

Re: [PHP] isset

2007-04-16 Thread tedd
At 4:08 PM +0100 4/16/07, Stut wrote: Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] = and isset thinks is set I

Re: [PHP] isset

2007-04-16 Thread Stut
tedd wrote: At 4:08 PM +0100 4/16/07, Stut wrote: Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] = and isset

Re: [PHP] isset

2007-04-16 Thread Jim Lucas
Stut wrote: tedd wrote: At 4:08 PM +0100 4/16/07, Stut wrote: Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] =

Re: [PHP] isset

2007-04-16 Thread Afan Pasalic
that was actually my point. :) -afan Stut wrote: tedd wrote: At 4:08 PM +0100 4/16/07, Stut wrote: Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it

Re: [PHP] isset

2007-04-16 Thread Jim Lucas
Stut wrote: Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] = and isset thinks is set I use this combination a

Re: [PHP] isset

2007-04-16 Thread Edward Vermillion
On Apr 16, 2007, at 11:27 AM, Jim Lucas wrote: Stut wrote: Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST ['var'] =

Re: [PHP] isset

2007-04-16 Thread Robert Cummings
On Mon, 2007-04-16 at 09:27 -0700, Jim Lucas wrote: Stut wrote: Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because

Re: [PHP] isset

2007-04-16 Thread Stut
Jim Lucas wrote: Stut wrote: tedd wrote: At 4:08 PM +0100 4/16/07, Stut wrote: Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because

Re: [PHP] isset

2007-04-16 Thread Jim Lucas
Stut wrote: Jim Lucas wrote: Stut wrote: tedd wrote: At 4:08 PM +0100 4/16/07, Stut wrote: Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set.

Re: [PHP] isset

2007-04-16 Thread Robert Cummings
On Mon, 2007-04-16 at 18:16 +0100, Stut wrote: Jim Lucas wrote: Stut wrote: tedd wrote: At 4:08 PM +0100 4/16/07, Stut wrote: Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { }

Re: [PHP] isset

2007-04-16 Thread Edward Vermillion
On Apr 16, 2007, at 12:30 PM, Robert Cummings wrote: [snip] Bleh, my mistake... I'm so adverse to empty() I forgot it doesn't generate notices. Lemme guess... You don't like empty() because it thinks null/0/'' is empty? Or is there some other reason? Agreed, it can be tricky if you

Re: [PHP] isset

2007-04-16 Thread Robert Cummings
On Mon, 2007-04-16 at 13:16 -0500, Edward Vermillion wrote: On Apr 16, 2007, at 12:30 PM, Robert Cummings wrote: [snip] Bleh, my mistake... I'm so adverse to empty() I forgot it doesn't generate notices. Strings only containing only spaces are not empty. Strings containing a 0 are

Re: [PHP] isset

2007-04-16 Thread Edward Vermillion
On Apr 16, 2007, at 1:28 PM, Robert Cummings wrote: On Mon, 2007-04-16 at 13:16 -0500, Edward Vermillion wrote: On Apr 16, 2007, at 12:30 PM, Robert Cummings wrote: [snip] Bleh, my mistake... I'm so adverse to empty() I forgot it doesn't generate notices. Strings only containing only

Re: [PHP] isset

2007-04-16 Thread Stut
Robert Cummings wrote: On Mon, 2007-04-16 at 09:27 -0700, Jim Lucas wrote: Stut wrote: Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set.

Re: [PHP] isset

2007-04-16 Thread Richard Lynch
On Sat, April 14, 2007 8:36 pm, Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] = and isset thinks is set It *is* set. It just

Re: [PHP] isset

2007-04-16 Thread Richard Lynch
On Sun, April 15, 2007 12:07 pm, [EMAIL PROTECTED] wrote: I have E_NOTICE turned off. :) Your first mistake. :-) E_NOTICE on is a royal pain at first, but will catch bugs for you, and save you development time in the long run. Turn it on for your next new project and try it. -- Some people

RE: [PHP] isset

2007-04-16 Thread Tim Earl
-Message d'origine- De : Robert Cummings [mailto:[EMAIL PROTECTED] Envoyé : lundi 16 avril 2007 20:28 À : Edward Vermillion Cc : php Lists Objet : Re: [PHP] isset On Mon, 2007-04-16 at 13:16 -0500, Edward Vermillion wrote: On Apr 16, 2007, at 12:30 PM, Robert Cummings wrote

Re: [PHP] isset

2007-04-16 Thread Richard Lynch
On Mon, April 16, 2007 11:12 am, tedd wrote: I've been accuse of that too, but what's your solution? *MY* solution: Don't use empty because its behaviour changed wrt 0 in various versions, so it's just gonna bite you in the butt like it did me. :-) I generally do this basic algorithm: #1 Use

RE: [PHP] isset

2007-04-16 Thread Richard Lynch
On Mon, April 16, 2007 5:35 pm, Tim Earl wrote: What about in the following context? $arr = array(); If (!empty($arr)) { } This is where i have found it to be the most usefull... If I'm already certain that it's an array, I just use 'count' personally. 'empty' takes a mixed data type, and

Re: [PHP] isset

2007-04-16 Thread Richard Lynch
On Mon, April 16, 2007 11:18 am, Jim Lucas wrote: these two lines are not the same infact, with the first, you will not get a E_NOTICE warning, but with the second you will. I dunno what you are thinking of, but the manual says: empty() is the opposite of (boolean) var, except that no warning

Re: [PHP] isset

2007-04-16 Thread Jochem Maas
Richard Lynch wrote: On Mon, April 16, 2007 5:35 pm, Tim Earl wrote: What about in the following context? $arr = array(); If (!empty($arr)) { } This is where i have found it to be the most usefull... If I'm already certain that it's an array, I just use 'count' personally. 'empty'

Re: [PHP] isset

2007-04-16 Thread Al
I've been using empty() for about 5 years, obeying the rules for empty() in the php manual Appendix P. PHP type comparison tables and have never seen it generate any type of error message. If you guys know of at least one exception, please clue us in on it. Jim Lucas wrote: Stut wrote:

Re: [PHP] isset

2007-04-16 Thread Richard Lynch
On Mon, April 16, 2007 6:10 pm, Jochem Maas wrote: if I know it's an array I'll definitely use empty() over count() count() needs to actually count the items where as empty() can return false as soon as it finds a singel element ... maybe I'm mistaken - if so please put me right.

Re: [PHP] isset

2007-04-16 Thread Robert Cummings
On Mon, 2007-04-16 at 19:05 -0500, Richard Lynch wrote: On Mon, April 16, 2007 6:10 pm, Jochem Maas wrote: if I know it's an array I'll definitely use empty() over count() count() needs to actually count the items where as empty() can return false as soon as it finds a singel element

Re: [PHP] isset

2007-04-15 Thread Jochem Maas
Afan Pasalic wrote: Jochem Maas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] = and isset thinks is set

Re: [PHP] isset

2007-04-15 Thread afan
Afan Pasalic wrote: Jochem Maas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] = and isset thinks is set php -r '

Re: [PHP] isset

2007-04-15 Thread Larry Garfield
On Sunday 15 April 2007 12:07 pm, [EMAIL PROTECTED] wrote: of course it's your call whether you write/run code that spits out E_NOTICEs all over the place due to usage of uninitialized vars. not quite sure. if $_GET['var'] doesn't exists it's DEFINITLY not equal to 'foo', right? how I

RE: [PHP] isset

2007-04-15 Thread Buesching, Logan J
To: [EMAIL PROTECTED] Subject: Re: [PHP] isset On Sunday 15 April 2007 12:07 pm, [EMAIL PROTECTED] wrote: of course it's your call whether you write/run code that spits out E_NOTICEs all over the place due to usage of uninitialized vars. not quite sure. if $_GET['var'] doesn't exists it's DEFINITLY

[PHP] isset

2007-04-14 Thread Richard Kurth
What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] = and isset thinks is set

Re: [PHP] isset

2007-04-14 Thread Jochem Maas
Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] = and isset thinks is set php -r ' $r = array(foo = );

[PHP] isset or array_key_exists?

2006-02-18 Thread Nikolay Rastegaev
Please, answer: what construction works faster: if ( isset ( $result [$i] [key] ) ) {do something; } or if ( array_key_exists ( key, $result [$i] ) ) {do something; } ? Nikolay

[PHP] isset

2005-02-15 Thread D_C
I often use this type of construct $cmd = $_POST['cmd']; if ($cmd == null) { // do default but this throws a notice if the ['cmd'] index is not defined. ugly. using if (isset($_POST['cmd'] ) { $cmd = $_POST['cmd']; } seems lengthy. is there a way around this? i tried using $cmd = @

Re: [PHP] isset

2005-02-15 Thread Richard Lynch
D_C wrote: I often use this type of construct $cmd = $_POST['cmd']; if ($cmd == null) { // do default but this throws a notice if the ['cmd'] index is not defined. ugly. using if (isset($_POST['cmd'] ) { $cmd = $_POST['cmd']; } seems lengthy. is there a way around this? i tried

Re: [PHP] isset

2005-02-15 Thread Burhan Khalid
D_C wrote: I often use this type of construct $cmd = $_POST['cmd']; if ($cmd == null) { // do default but this throws a notice if the ['cmd'] index is not defined. ugly. using if (isset($_POST['cmd'] ) { $cmd = $_POST['cmd']; } seems lengthy. is there a way around this?

[PHP] isset opposite

2004-11-16 Thread Dustin Krysak
Hi there.. I am pretty new to PHP, and I am familiar with php isset option now i was wondering (I have looked at the PHP site - but can not find it) how can you check if something is not set? I need to test if a $_GET is not set (not just empty). thanks in advance! d -- PHP General

Re: [PHP] isset opposite

2004-11-16 Thread Matthew Sims
Hi there.. I am pretty new to PHP, and I am familiar with php isset option now i was wondering (I have looked at the PHP site - but can not find it) how can you check if something is not set? I need to test if a $_GET is not set (not just empty). thanks in advance! d I'm sure

Re: [PHP] isset opposite

2004-11-16 Thread Greg Donald
On Tue, 16 Nov 2004 15:11:39 -0800, Dustin Krysak [EMAIL PROTECTED] wrote: how can you check if something is not set? !isset() -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] isset opposite

2004-11-16 Thread Ryan King
On Nov 16, 2004, at 5:11 PM, Dustin Krysak wrote: Hi there.. I am pretty new to PHP, and I am familiar with php isset option now i was wondering (I have looked at the PHP site - but can not find it) how can you check if something is not set? I need to test if a $_GET is not set

Re: [PHP] isset opposite

2004-11-16 Thread Robby Russell
On Tue, 2004-11-16 at 15:11 -0800, Dustin Krysak wrote: Hi there.. I am pretty new to PHP, and I am familiar with php isset option now i was wondering (I have looked at the PHP site - but can not find it) how can you check if something is not set? I need to test if a $_GET

Re: [PHP] isset opposite

2004-11-16 Thread Dustin Krysak
Thanks! perfect! d On 16-Nov-04, at 4:13 PM, Robby Russell wrote: On Tue, 2004-11-16 at 15:11 -0800, Dustin Krysak wrote: Hi there.. I am pretty new to PHP, and I am familiar with php isset option now i was wondering (I have looked at the PHP site - but can not find it) how can you check

Re: [PHP] isset opposite

2004-11-16 Thread Robby Russell
On Tue, 2004-11-16 at 17:19 -0800, Dustin Krysak wrote: Thanks! perfect! d For future reference, just about any function that uses is at the beginning should return a boolean result. So if (is_array()) can also be checked with if (!is_array()) This should apply to all the php included

Re: [PHP] isset opposite

2004-11-16 Thread Dustin Krysak
Yeah as soon as I saw this example, I figured that was the case for example something like if (!empty()) and so on. d On 16-Nov-04, at 5:26 PM, Robby Russell wrote: On Tue, 2004-11-16 at 17:19 -0800, Dustin Krysak wrote: Thanks! perfect! d For future reference, just about any function that

[PHP] ISSET problem with Form

2004-05-27 Thread Tom Chubb
If you use ISSET together with a hidden field when posting a form to itself to enter a second-state, is there a way of using it again to get to a third-state. Basically, I'm trying to convert a 3 file script into a single file and first I check to see if it's been submitted and then using ELSE I

RE: [PHP] ISSET problem with Form

2004-05-27 Thread Jay Blanchard
[snip] I've had the script working with two states but can't get the third state working!!! Any help or alternative ideas much appreciated as this is causing me a serious headache!!! [/snip] Sessions would be a better way to handle this. -- PHP General Mailing List (http://www.php.net/) To

RE: [PHP] ISSET problem with Form

2004-05-27 Thread Jay Blanchard
[snip] I'm new to PHP, so how would I go about using sessions? I assume one needs to update _SESSION['name'] = $name; with the state of the form and then use IF ? Then I'm stuck again! [/snip] start here http://www.php.net/session P.S. Always reply to the list, you may not get a response. Your

Re: [PHP] isset() and !=NULL

2004-03-28 Thread Dimiter Naydenov
David Risner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Fri, 26 Mar 2004 10:40:43 -0800, Marcjon Louwersheimer [EMAIL PROTECTED] said: Is there an easier way to do isset($variable) AND $variable != NULL ? I use this alot in my if statements, and I was wondering if there's

[PHP] isset() and !=NULL

2004-03-26 Thread Marcjon Louwersheimer
Is there an easier way to do isset($variable) AND $variable != NULL ? I use this alot in my if statements, and I was wondering if there's an easier way to do it, maybe with a single function? Oh and another question... how does if ($variable) work? When does it evaluate true? -- Marcjon --

Re: [PHP] isset() and !=NULL

2004-03-26 Thread Rasmus Lerdorf
if(!empty($variable)) On Fri, 26 Mar 2004, Marcjon Louwersheimer wrote: Is there an easier way to do isset($variable) AND $variable != NULL ? I use this alot in my if statements, and I was wondering if there's an easier way to do it, maybe with a single function? Oh and another question...

Re: [PHP] isset() and !=NULL

2004-03-26 Thread Robert Cummings
On Fri, 2004-03-26 at 13:46, Rasmus Lerdorf wrote: if(!empty($variable)) This will return false positives for cases where the variable has not been set to null but HAS been set to the empty string or to a 0? This isn't really the same as the OP requested. However, isset() also returns false for

Re: [PHP] isset() and !=NULL

2004-03-26 Thread David Risner
On Fri, 26 Mar 2004 10:40:43 -0800, Marcjon Louwersheimer [EMAIL PROTECTED] said: Is there an easier way to do isset($variable) AND $variable != NULL ? I use this alot in my if statements, and I was wondering if there's an easier way to do it, maybe with a single function? Oh and another

Re[2]: [PHP] isset() question

2004-02-16 Thread Richard Davey
Hello Jason, Sunday, February 15, 2004, 7:44:06 PM, you wrote: I feel the book you're learning from might not be the best out there! Especially as it uses the horrible if : else : endif notation, includes code on the same line as the PHP tags themselves JW What is horrible about that style?

RE: [PHP] isset() question

2004-02-16 Thread Ford, Mike [LSS]
On 15 February 2004 18:30, Richard Davey wrote: I feel the book you're learning from might not be the best out there! Especially as it uses the horrible if : else : endif notation, I'd have to disagree with you on that one -- personally I think that's a very elegant and useful syntax, and all

Re: Re[2]: [PHP] isset() question

2004-02-16 Thread Jason Wong
On Monday 16 February 2004 18:14, Richard Davey wrote: Consistency. With what? With whose idea of style/formatting? I doubt you will find consistency in the real between different programmers/organisations. If such consistency was there then PHP would've have only had to support a single

Re[4]: [PHP] isset() question

2004-02-16 Thread Richard Davey
Hello Jason, Monday, February 16, 2004, 2:21:01 PM, you wrote: Consistency. JW With what? With whose idea of style/formatting? If you hadn't chopped off the rest of my paragraph you'd have the answer. JW I doubt you will find consistency in the real between different JW

[PHP] isset() question

2004-02-15 Thread Anthony Ritter
The following script is from Kevin Yank's book (Sitepoint). When I test it _without_ entering a name in the text box and hit submit, the _next_ page loads - however the same page should load beacuse of the conditional if (!isset($name) ): . If I replace !isset() with empty()

Re: [PHP] isset() question

2004-02-15 Thread Richard Davey
Hello Anthony, Sunday, February 15, 2004, 4:43:12 PM, you wrote: AR Why doesn't the call to !isset() with the negation mark loads the next page AR when a name is not entered? Because it's using isset() in the wrong capacity. isset() does not check to see if a variable HAS a value, it checks to

Re: [PHP] isset() question

2004-02-15 Thread Anthony Ritter
- Original Message - From: Richard Davey [EMAIL PROTECTED] Hello Anthony, I feel the book you're learning from might not be the best out there! Especially as it uses the horrible if : else : endif notation, includes code on the same line as the PHP tags themselves and is teaching

Re: [PHP] isset() question

2004-02-15 Thread Jason Wong
On Monday 16 February 2004 02:30, Richard Davey wrote: I feel the book you're learning from might not be the best out there! Especially as it uses the horrible if : else : endif notation, includes code on the same line as the PHP tags themselves What is horrible about that style? IMO doing

[PHP] isset bug?

2003-08-22 Thread Christian Calloway
Ok, here's the deal. I like to use $_GET and $_POST variables without values to notify my scripts that some action must be taken. For example, given the following URL: http://blahdomain/blah.php?productid=1edit or given the following form element: input type=hidden name=edit My blah.php script

  1   2   >