Jump to content

Can someone show me how to properly write this short if statement?


KDM

Recommended Posts

Will evaluate if $car_class evaluates to any value that is considered false:

if ($car_class == FALSE) {
   echo   '<span class="warning">*</span>';
}

This will do the same:

if (!$car_class) {
   echo   '<span class="warning">*</span>';
}

This will check to make sure the value is actually boolean false:

if ($car_class === FALSE) {
   echo   '<span class="warning">*</span>';
}

 

 

Link to comment
Share on other sites

is that line 421?

if ("$car_class") == FALSE {
		echo   '<span class="warning">*</span>';
	}

here's the structure of if statement

   if(  condition   )
   {
      //execute code if condition is true
   }

you didn't close the codition ")"

so close the condition after the ==False

 

Link to comment
Share on other sites

in this case if the OP doesnt even understand how to write a simple if statement, i beleive that the manual is the best place for him/her to look and understand PHP..i agree with what Maq posted, will lead to more enlightment here

Link to comment
Share on other sites

in this case if the OP doesnt even understand how to write a simple if statement, i beleive that the manual is the best place for him/her to look and understand PHP..i agree with what Maq posted, will lead to more enlightment here

i usually have a hard time understanding the manual actually because they don't explain much just show you with examples...

i go there for syntax not for understanding :) but not all people are a like 8) we all are unique and special like everyone else lol

Link to comment
Share on other sites

in this case if the OP doesnt even understand how to write a simple if statement, i beleive that the manual is the best place for him/her to look and understand PHP..i agree with what Maq posted, will lead to more enlightment here

i usually have a hard time understanding the manual actually because they don't explain much just show you with examples...

i go there for syntax not for understanding :) but not all people are a like 8) we all are unique and special like everyone else lol

it is a mixture of text explanation and written examples.. it is absolutely essential to look there to fully understand many PHP concepts..

 

we all are unique and special like everyone else lol

Some of us more than others. *cough* premiso *cough*

 

KDM, did you figure it out?

 

that made me laugh..

Link to comment
Share on other sites

it is absolutely essential to look there to fully understand many PHP concepts..

totally agree. i feel like the manual is for the elites lol, maybe just me  :-[

it is absolutely essential to look there to fully understand many PHP concepts..

and there's a fine line between being uniqu/speical and nerd/geek  ;D

Link to comment
Share on other sites

in this case if the OP doesnt even understand how to write a simple if statement, i beleive that the manual is the best place for him/her to look and understand PHP..i agree with what Maq posted, will lead to more enlightment here

i usually have a hard time understanding the manual actually because they don't explain much just show you with examples...

i go there for syntax not for understanding :) but not all people are a like 8) we all are unique and special like everyone else lol

 

thanks, very well said.

Link to comment
Share on other sites

if you want to check if the send button was click

use

  if(isset($_POST['subment']))
  {
     if( condition)
     {
        //if $car_class is false execute code here
      }
  }

the isset will check if the button is pressed assument the button is named 'submit'

Link to comment
Share on other sites

if you want to check if the send button was click

use

  if(isset($_POST['subment']))
  {
     if( condition)
     {
        //if $car_class is false execute code here
      }
  }

the isset will check if the button is pressed assument the button is named 'submit'

 

in this case if it is named.. "subment" ... :shrug:

Link to comment
Share on other sites

if you want to check if the send button was click

use

  if(isset($_POST['subment']))
  {
     if( condition)
     {
        //if $car_class is false execute code here
      }
  }

the isset will check if the button is pressed assument the button is named 'submit'

 

in this case if it is named.. "subment" ... :shrug:

yup, thnx AK47

i can't type today :'(

Link to comment
Share on other sites

if you want to check if the send button was click

use

  if(isset($_POST['subment']))
  {
     if( condition)
     {
        //if $car_class is false execute code here
      }
  }

the isset will check if the button is pressed assument the button is named 'submit'

 

@KDM: FYI- this could be condensed into one statement if you wanted; like:

if (isset($_POST['submit']) && $car_class == FALSE) {
// code to execute
}

Link to comment
Share on other sites

if you want to check if the send button was click

use

  if(isset($_POST['subment']))
  {
     if( condition)
     {
        //if $car_class is false execute code here
      }
  }

the isset will check if the button is pressed assument the button is named 'submit'

 

@KDM: FYI- this could be condensed into one statement if you wanted; like:

if (isset($_POST['submit']) && $car_class == FALSE) {
// code to execute
}

no, don't do that!!!

the,

reason,

is

i'm kidding :D

Link to comment
Share on other sites

if you want to check if the send button was click

use

  if(isset($_POST['subment']))
  {
     if( condition)
     {
        //if $car_class is false execute code here
      }
  }

the isset will check if the button is pressed assument the button is named 'submit'

 

Thanks for the help! I tried if isset before but didn't use the post variable. And I had to change submit to send. It's working fine now. Thanks a lot. I learned something.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.