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
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
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
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
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
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
Io, try do like this:
You should use $_POST for the security, using $_REQUEST some users can pass a
inject or someting to crash the aplication, and addslashes is for more security
$firstName = addslashes($_POST['firstname']);
if(isset($firstName) !empty($firstName)) {
$name =
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:
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,
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,
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
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
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
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:
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 : ;
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
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
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
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
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
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.
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
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
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
-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]
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:
# [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
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
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
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
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
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()
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
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 (
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 (
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.
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
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
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'] =
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
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
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'] =
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
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
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.
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'])) {
}
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
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
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
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.
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
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
-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
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
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
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
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'
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:
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.
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
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
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 '
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
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
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 = );
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
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?
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
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:
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 (not
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 is not
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
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
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
[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
[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
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
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...
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
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
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
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
- 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
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
* Thus wrote Christian Calloway ([EMAIL PROTECTED]):
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
What I was trying to avoid is exactly that. It would require changing links
and hidden fields throughout the entire application, which would take hours
to track down. I am looking for a nice lazy and easy fix.
Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
* Thus wrote
This should help:
http://www.php.net/manual/en/function.array-key-exists.php
Cheers,
Rob.
On Fri, 2003-08-22 at 13:26, Curt Zirzow wrote:
* Thus wrote Christian Calloway ([EMAIL PROTECTED]):
Ok, here's the deal. I like to use $_GET and $_POST variables without values
to notify my
What about the rest of the code? How is this variable defined? I have
had this happen in some code before, I found that the variable was set to
. Try using:
if (isset($SenderEmailAddress) $SenderEmailAddress != ) {
mail($mailTo, $mailSubject, $Message);
}
I have the following code :
... or:
if(!empty($SenderEmailAddress))
{
...
}
Dean E. Weimer wrote:
What about the rest of the code? How is this variable defined? I
have had this happen in some code before, I found that the variable
was set to . Try using:
if (isset($SenderEmailAddress) $SenderEmailAddress != ) {
On Thursday 10 July 2003 21:53, Denis L. Menezes wrote:
I have the following code :
Quote:
if (isset($SenderEmailAddress)){
mail($mailTo, $mailSubject, $Message);
}
Unquote
All I want to do is that , if the $SenderEmailAddress is not entered, the
mail() function should not run.
Hello everyone. I was able to determine what was causing my problem
with session variables not being persitant across page requests. I want
to give you the full scope here, so I'm going to paste the code (and if
you have any code tips, please let me know).
I think the problem might be this
On Tuesday 01 July 2003 12:46, John Manko wrote:
Hello everyone. I was able to determine what was causing my problem
with session variables not being persitant across page requests. I want
to give you the full scope here, so I'm going to paste the code (and if
you have any code tips, please
Why is my script autopopulating a 1 in the field names and not the orginal
values ?
Is it something to do with this statement ?
$output_fname = isset($HTTP_POST_VARS['fname']);
Im declaring the var and using it in value field in my form. I know that I
missing something. Its returning true when
$output_fname = (isset($HTTP_POST_VARS['fname'])) ? $HTTP_POST_VARS['fname']
: '';
but the value WILL be set regardless... in this case i'd prefer:
if(isset($HTTP_POST_VARS['fname'])) { $output_fname =
$HTTP_POST_VARS['fname']; }
alternatively, I wrote a nice function to pluck out $_POST vars
Responding to myself:
Is isset() better than $ != ?
Often, I may have a 0 as values. While $ != doesn't recognize 0s (as in,
that if would be false), isset() seems to work. Should I change all my $ !=
to isset()s, or are there other factors I should check?
Conversely, what about empty(). Is
It depends on what you're trying to test.
If you want to find out if a variable is explicitly set to an empty
string, then isset() is not your answer. If you want find out if a
variable exists or is set to a non-null value, isset() will work.
However, it is not always going to give you the
I don't know if this is a bug, or what, but I get an error when trying
the
following
if ( isset($adodbobject-Fields('myresult') ) ) { // do something }
PHP throws an error ( not warning ) saying:
Parse error: parse error, expecting `','' or `')'' in
/path/to/index.php
on
line 45
That's because isset() is expecting a variable, not a function. In your
first example, you're trying to see if a function is set, not a
variable. In your second example, you're doing it right...
---John Holmes...
That actually makes sense once I thought about it, a function referencing a
On Sun, 10 Nov 2002 18:34:52 -0600, you wrote:
PS: what is the proper term for the - syntax? pointer?
In Perl it's called an infix operator. I think in PHP the technical
term for it is that - thingy... :-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Just use empty() ?!
With error_reporting(E_ALL) you'll get a bunch of warnings if you only use
empty() w/o the isset() !
use isset() first and then check wheter empty or not empty!
so there is not one function that tests for empty and isset same time!?
Elias
Analysis Solutions [EMAIL
1 - 100 of 144 matches
Mail list logo