Re: if statment
| From: | Leif K-Brooks | Date: | Mon, 31 Mar 2003 22:19:19 +0000 |
| Subject: | Re: if statment | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-141755@lists.php.net to get a copy of this message | ||
You should be using if(!isset($HTTP_GET_VARS['id'])){ Otherwise, it generates an eror when it simply doesn't exist. "" and nothing (an unset variable) are NOT the same.
Tim Haskins wrote:
below is what I have currently <?php if ($HTTP_GET_VARS["id"] == "") { ?> its empty <?php }?> Now when I change the == to <> I receive the following error: Notice: Undefined index: id in c:\inetpub\wwwroot\_\users.php on line 103 Why would that not work - In asp it does, but I can't get it workin in php. If that doesn't make sense, I would like to have an if statement the says, if HTTP_GET_VARS["id"] is NOT empty then show something else Thanks for you guy's help and time -- Tim Haskins "Tim Haskins" <tim@copiousdg.com> wrote in message news:20030331201648.85534.qmail@pb1.pair.com...ofWow, that's weird- I had just tried it and that didn't work, so I thoughtitmight be some special php thing goin on- thanks for your help! -- Tim Haskins "Jennifer Goodie" <goodie@apollointeractive.com> wrote in message news:NEBBIJJIKBGCCCNKMPBCMEIIGNAA.goodie@apollointeractive.com...theso change it to "" -----Original Message----- From: Tim Haskins [mailto:tim@copiousdg.com] Sent: Monday, March 31, 2003 12:12 PM To: php-general@lists.php.net Subject: Re: [PHP] if statment My bad, I actually meant that the "nothing" was like, if the pr_ID inurl is empty then show the following text. -- Tim Haskins "Jennifer Goodie" <goodie@apollointeractive.com> wrote in message news:NEBBIJJIKBGCCCNKMPBCCEIGGNAA.goodie@apollointeractive.com...statementif( $HTTP_GET_VARS["pr_ID"] == "nothing"){ echo "there are no products"; } http://www.php.net/manual/en/control-structures.php http://www.php.net/manual/en/ -----Original Message----- From: Tim Haskins [mailto:tim@copiousdg.com] Sent: Monday, March 31, 2003 11:56 AM To: php-general@lists.php.net Subject: [PHP] if statment I'm used to asp and not php, but what would the code be for and ifthat was like: if $HTTP_GET_VARS["pr_ID"] = "nothing" then "there are no products" end if Also does anyone know a great resource that lists different examples
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.php-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpvariables, if statements, and so on? Thanks so much! -- Tim Haskins