Jump to content

Recommended Posts

Looks like you have one too many open parens at the beginning maybe.

 

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

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

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

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.