You are here: Re: if statement « PHP Programming Language « IT news, forums, messages
Re: if statement

Posted by Kimmo Laine on 11/06/06 07:16

"Geoff Muldoon" <geoff.muldoon@trap.gmail.com> wrote in message
news:MPG.1fb969feaad9fefe98987f@news.readfreenews.net...
> phil.latio@f-in-stupid.co.uk says...
>> I am trying to remember how you write an if statement to check if any
>> value
>> has been entered. For example seeing if a username has been entered in
>> form.
>> I have seen the following:
>>
>> if ($username == '')
>> {
>> print ("You've pressed submit without entering your username");
>> }
>>
>> However is there another method which uses an exclamation mark? I am sure
>> I
>> have seen something for where $username has no value but I can't think
>> what
>> it was.
>
> isSet ??
>
> if (!isSet($username)) { // do this if $username is not set


If this is form validation, then isset won't do any good. The form field
will be set, but it still may be empty. Better test that strlen() is greater
than zero, or use empty(). And Of course, there's always the $username vs.
$_POST['username'] issue. Seems like someone is using register_globals, for
shame...

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация