RE: [PHP] Not sure of my error
| From: | Maxim Maletsky | Date: | Mon, 20 Nov 2000 02:09:01 +0000 |
| Subject: | RE: [PHP] Not sure of my error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-26175@lists.php.net to get a copy of this message | ||
Right ....
Sorry ...
I just woke up 25 minutes ago and late to work - my brain is still sleeping
...
:-)))
if (!isset ($state)) {
$then = 'Go';
}
Cheers!
Maxim Maletsky
-----Original Message-----
From: Lawrence.Sheed@dfait-maeci.gc.ca
[mailto:Lawrence.Sheed@dfait-maeci.gc.ca]
Sent: Monday, November 20, 2000 10:58 AM
To: Maxim Maletsky; philip@theprojects.org; joe@earth.care2.com
Cc: jerryl@europa.com; php-general@lists.php.net
Subject: RE: [PHP] Not sure of my error
Isn't is
if (!isset ($state)) {
//do stuff.
}
-----Original Message-----
From: Maxim Maletsky [mailto:maxim.maletsky@japaninc.net]
Sent: November 20, 2000 09:47 AM
To: 'Philip Olson'; Joe Stump
Cc: Jerry Lake; php-general@lists.php.net
Subject: RE: [PHP] Not sure of my error
the most accurate way to check if the variable is set to something would be:
if(!is_set($state)){
$then = 'Go!';
}
Cheers,
Maxim Maletsky
-----Original Message-----
From: Philip Olson [mailto:philip@theprojects.org]
Sent: Saturday, November 18, 2000 9:43 AM
To: Joe Stump
Cc: Jerry Lake; php-general@lists.php.net
Subject: Re: [PHP] Not sure of my error
Interesting, never used strlen for this reason before , does it work
nicely? I am used to using empty() and isset() for such things.
Joe, why do you always have to be so different? ;-) Wonderful how
flexible this all is huh?
At any rate, I would do this :
<?php
if (empty($state))
{
echo 'Enter state please!';
}
else
{
echo 'Your state was '.$state;
}
?>
I know that if $state were '0' then it is not considered empty, but this
does not seem to apply here, right? Always looking for new little tips
...
philip
--
be outside the box.
On Fri, 17 Nov 2000, Joe Stump wrote:
> Try this:
>
> <?
>
> if(!strlen($state)){
> "dude enter a state!";
> }else{
> "you state was: ".$state;
> }
>
> ?>
>
> --Joe
>
>
> On Fri, Nov 17, 2000 at 04:11:17PM -0800, Jerry Lake wrote:
> > For some reason the code below
> > always returns as true even if
> > there State == "whatever" It looks
> > correct to me, but apparently isn't.
> > <?
> > if ($state == "");
> > {
> > echo "<div align=center>";
> > echo "$state";
> > echo "<h3>Please enter a state name</h3>";
> > echo "</div>";
> > exit;
> > }
> > else
> > {
> > stuff
> > }
> > ?>
> >
> > Jerry Lake
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
============================================================================
====
> = Joe Stump joestump98@yahoo.com
http://www.miester.org =
>
============================================================================
====
> "Real programmers don't comment their code.
> It was hard to write, it should be hard to understand."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net