Jump to content

[SOLVED] IF ?


Clinton

Recommended Posts

Have I got this written wrong or does it not like the ***?

 

if ((!empty($_POST['dtype']) OR ($_POST['dtype'] == "***SELECT***")) { $dtype = $_POST['dtype']; }
          else 	{ $errors[] = '<font color="red">You did not enter a degree type.</font>'; }

 

phpDesigner is saying unexpected {.

 

It is probably just the phpDesigner. That code looks valid to me. It most likely does not like everything being on oneline. But I would go with Flyhoney's if, since the simple fact that you do not need the extra parans and they just make it more confusing.

Link to comment
https://forums.phpfreaks.com/topic/139904-solved-if/#findComment-731957
Share on other sites

Check this line:

if ((!empty($_POST['dtype']) OR ($_POST['dtype'] == "***SELECT***"))

 

4 opening parens and 3 closing.

 

should be:

if (!empty($_POST['dtype']) or $_POST['dtype'] == "***SELECT***")

 

hence the parser is running into a '{' when it is looking fo rthe 4th closing paren.

Link to comment
https://forums.phpfreaks.com/topic/139904-solved-if/#findComment-731965
Share on other sites

Check this line:

if ((!empty($_POST['dtype']) OR ($_POST['dtype'] == "***SELECT***"))

 

4 opening parens and 3 closing.

 

should be:

if (!empty($_POST['dtype']) or $_POST['dtype'] == "***SELECT***")

 

hence the parser is running into a '{' when it is looking fo rthe 4th closing paren.

 

There you go. Even I missed the missing ) after the !empty portion.

 

As stated, it makes a ton less confusing omitting them =)

Link to comment
https://forums.phpfreaks.com/topic/139904-solved-if/#findComment-731991
Share on other sites

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.