Jump to content

[SOLVED] Help With If Statement Syntax


webref.eu

Recommended Posts

Hi All

 

I have to code an statement that says "If not the conditions where processform is 1 AND ErrorMsg is empty string".  So far I have this: 

 

If !($_POST['processform'] == 1 AND ErrorMsg == "") {

 

which I know is wrong.  Can anyone help me correct it?

 

Thanks All.

Link to comment
https://forums.phpfreaks.com/topic/120371-solved-help-with-if-statement-syntax/
Share on other sites

Guys, I still don't think I have this right.  Let me explain further: 

 

Under these conditions: 

 

$_POST['processform'] == 1

AND

ErrorMsg == ""

 

I don't want a form to be displayed, so I have to write and If statement saying If Not both the above mentioned conditions.  If think it's something like: 

 

If !(($_POST['processform'] == 1) && (ErrorMsg == "")) {

 

but this still isn't quite right as I'm getting an unexpected ! error. 

 

Thanks all.

Thanks for your help with the logic statement.  Here is the code that I have found to work the way I wanted regarding when to display the form: 

 

<?php
If (!($_POST['processform'] == 1 && $ErrorMsg == "")) {
?>

<!-- display the form -->
<form> ... </form>

<?php
//end if
}
?>

 

Rgds

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.