Jump to content

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

 

 

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.