Clinton Posted January 7, 2009 Share Posted January 7, 2009 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 {. Quote Link to comment https://forums.phpfreaks.com/topic/139904-solved-if/ Share on other sites More sharing options...
flyhoney Posted January 7, 2009 Share Posted January 7, 2009 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>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/139904-solved-if/#findComment-731951 Share on other sites More sharing options...
premiso Posted January 7, 2009 Share Posted January 7, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/139904-solved-if/#findComment-731957 Share on other sites More sharing options...
flyhoney Posted January 7, 2009 Share Posted January 7, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/139904-solved-if/#findComment-731965 Share on other sites More sharing options...
premiso Posted January 7, 2009 Share Posted January 7, 2009 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 =) Quote Link to comment https://forums.phpfreaks.com/topic/139904-solved-if/#findComment-731991 Share on other sites More sharing options...
Clinton Posted January 8, 2009 Author Share Posted January 8, 2009 Thanks guys. I'm glad I'm not the only one who missed it... ;-) Quote Link to comment https://forums.phpfreaks.com/topic/139904-solved-if/#findComment-732104 Share on other sites More sharing options...
Clinton Posted January 8, 2009 Author Share Posted January 8, 2009 Never Mind... Quote Link to comment https://forums.phpfreaks.com/topic/139904-solved-if/#findComment-732123 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.