Re: [PHP] if statment
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 its empty 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" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Wow, that's weird- I had just tried it and that didn't work, so I thought it might be some special php thing goin on- thanks for your help! -- Tim Haskins "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] so change it to "" -Original Message- From: Tim Haskins [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 12:12 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] if statment My bad, I actually meant that the "nothing" was like, if the pr_ID in the url is empty then show the following text. -- Tim Haskins "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] if( $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:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 11:56 AM To: [EMAIL PROTECTED] Subject: [PHP] if statment I'm used to asp and not php, but what would the code be for and if statement that 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 of php variables, if statements, and so on? Thanks so much! -- Tim Haskins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 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.
Re: [PHP] if statment
On 31-Mar-2003 Tim Haskins wrote: > My bad, I actually meant that the "nothing" was like, if the pr_ID in the > url is empty then show the following text. > if (empty($HTTP_GET_VARS["pr_ID"])) Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if statment
--- Tim Haskins <[EMAIL PROTECTED]> wrote: > 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. Are you kidding? You do realize that ASP and PHP are not the same thing, right? > 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 if (!empty($_GET['id'])) { echo 'Something else'; } Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] if statment
Because not equal is !=, not <> I think I posted a link to the documentation a few eamils ago in this thread. Check it out, these are all really easy syntax questions, so you'll save yourself much hair pulling by just reading the section on basic syntax. -Original Message- From: Tim Haskins [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 12:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] if statment below is what I have currently its empty 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" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Wow, that's weird- I had just tried it and that didn't work, so I thought it > might be some special php thing goin on- thanks for your help! > > -- > Tim Haskins > > > > "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > so change it to "" > > > > -Original Message----- > > From: Tim Haskins [mailto:[EMAIL PROTECTED] > > Sent: Monday, March 31, 2003 12:12 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] if statment > > > > > > My bad, I actually meant that the "nothing" was like, if the pr_ID in the > > url is empty then show the following text. > > > > -- > > Tim Haskins > > > > "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > > > > if( $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:[EMAIL PROTECTED] > > > Sent: Monday, March 31, 2003 11:56 AM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] if statment > > > > > > > > > I'm used to asp and not php, but what would the code be for and if > > statement > > > that 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 of > > php > > > variables, if statements, and so on? > > > > > > Thanks so much! > > > -- > > > Tim Haskins > > > > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if statment
below is what I have currently its empty 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" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Wow, that's weird- I had just tried it and that didn't work, so I thought it > might be some special php thing goin on- thanks for your help! > > -- > Tim Haskins > > > > "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > so change it to "" > > > > -Original Message- > > From: Tim Haskins [mailto:[EMAIL PROTECTED] > > Sent: Monday, March 31, 2003 12:12 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] if statment > > > > > > My bad, I actually meant that the "nothing" was like, if the pr_ID in the > > url is empty then show the following text. > > > > -- > > Tim Haskins > > > > "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > > > > if( $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:[EMAIL PROTECTED] > > > Sent: Monday, March 31, 2003 11:56 AM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] if statment > > > > > > > > > I'm used to asp and not php, but what would the code be for and if > > statement > > > that 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 of > > php > > > variables, if statements, and so on? > > > > > > Thanks so much! > > > -- > > > Tim Haskins > > > > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] if statment
I'm pretty sure that if it was in a form but left blank isset() won't work because it is set in the globals, it is just empty. I've never used empty(), so I cannot comment on its behavior. -Original Message- From: Pete James [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 12:17 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] if statment Also, take a look at isset() and empty() http://php.net/empty http://php.net/isset Jennifer Goodie wrote: > so change it to "" > > -Original Message- > From: Tim Haskins [mailto:[EMAIL PROTECTED] > Sent: Monday, March 31, 2003 12:12 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] if statment > > > My bad, I actually meant that the "nothing" was like, if the pr_ID in the > url is empty then show the following text. > > -- > Tim Haskins > > "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>if( $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:[EMAIL PROTECTED] >>Sent: Monday, March 31, 2003 11:56 AM >>To: [EMAIL PROTECTED] >>Subject: [PHP] if statment >> >> >>I'm used to asp and not php, but what would the code be for and if > > statement > >>that 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 of > > php > >>variables, if statements, and so on? >> >>Thanks so much! >>-- >>Tim Haskins >> >> >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if statment
Also, take a look at isset() and empty() http://php.net/empty http://php.net/isset Jennifer Goodie wrote: so change it to "" -Original Message- From: Tim Haskins [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 12:12 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] if statment My bad, I actually meant that the "nothing" was like, if the pr_ID in the url is empty then show the following text. -- Tim Haskins "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] if( $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:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 11:56 AM To: [EMAIL PROTECTED] Subject: [PHP] if statment I'm used to asp and not php, but what would the code be for and if statement that 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 of php variables, if statements, and so on? Thanks so much! -- Tim Haskins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if statment
Wow, that's weird- I had just tried it and that didn't work, so I thought it might be some special php thing goin on- thanks for your help! -- Tim Haskins "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > so change it to "" > > -Original Message- > From: Tim Haskins [mailto:[EMAIL PROTECTED] > Sent: Monday, March 31, 2003 12:12 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] if statment > > > My bad, I actually meant that the "nothing" was like, if the pr_ID in the > url is empty then show the following text. > > -- > Tim Haskins > > "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > > if( $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:[EMAIL PROTECTED] > > Sent: Monday, March 31, 2003 11:56 AM > > To: [EMAIL PROTECTED] > > Subject: [PHP] if statment > > > > > > I'm used to asp and not php, but what would the code be for and if > statement > > that 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 of > php > > variables, if statements, and so on? > > > > Thanks so much! > > -- > > Tim Haskins > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] if statment
so change it to "" -Original Message- From: Tim Haskins [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 12:12 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] if statment My bad, I actually meant that the "nothing" was like, if the pr_ID in the url is empty then show the following text. -- Tim Haskins "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > if( $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:[EMAIL PROTECTED] > Sent: Monday, March 31, 2003 11:56 AM > To: [EMAIL PROTECTED] > Subject: [PHP] if statment > > > I'm used to asp and not php, but what would the code be for and if statement > that 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 of php > variables, if statements, and so on? > > Thanks so much! > -- > Tim Haskins > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if statment
My bad, I actually meant that the "nothing" was like, if the pr_ID in the url is empty then show the following text. -- Tim Haskins "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > if( $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:[EMAIL PROTECTED] > Sent: Monday, March 31, 2003 11:56 AM > To: [EMAIL PROTECTED] > Subject: [PHP] if statment > > > I'm used to asp and not php, but what would the code be for and if statement > that 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 of php > variables, if statements, and so on? > > Thanks so much! > -- > Tim Haskins > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] if statment
if( $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:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 11:56 AM To: [EMAIL PROTECTED] Subject: [PHP] if statment I'm used to asp and not php, but what would the code be for and if statement that 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 of php variables, if statements, and so on? Thanks so much! -- Tim Haskins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if statment
I'm used to asp and not php, but what would the code be for and if statement that 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 of php variables, if statements, and so on? Thanks so much! -- Tim Haskins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php