phpcode Posted September 24, 2007 Share Posted September 24, 2007 if (empty($password)==TRUE){ echo "You must enter a password! <a href\"install.php\">Click here to go back</a>"; } elseif (empty($myemail)==TRUE){ echo "You must enter your email address! <a href\"install.php\">Click here to go back</a>"; } elseif ($smtpcustom == "yes"){ if (empty($smtpserver)==TRUE || empty($smtpport)==TRUE){ echo "You selected yes for a custom SMTP server but you forgot to enter a server/port! "; } } else { echo "Installed"; } The problem I'm having is at:- elseif ($smtpcustom == "yes"){ If smtpserver/smtpport are empty it works but if they aren't empty the code doesn't work, can anyone see anything wrong with it? Quote Link to comment https://forums.phpfreaks.com/topic/70509-solved-if-help/ Share on other sites More sharing options...
darkfreaks Posted September 24, 2007 Share Posted September 24, 2007 try } else if (!empty($smtpserver)==TRUE ||!empty($smtpport)==TRUE){ echo "installed";} Quote Link to comment https://forums.phpfreaks.com/topic/70509-solved-if-help/#findComment-354190 Share on other sites More sharing options...
phpcode Posted September 24, 2007 Author Share Posted September 24, 2007 I didn't include the code that allows the user to select yes or no. Quote Link to comment https://forums.phpfreaks.com/topic/70509-solved-if-help/#findComment-354192 Share on other sites More sharing options...
darkfreaks Posted September 24, 2007 Share Posted September 24, 2007 try if not empty the above code Quote Link to comment https://forums.phpfreaks.com/topic/70509-solved-if-help/#findComment-354193 Share on other sites More sharing options...
roopurt18 Posted September 24, 2007 Share Posted September 24, 2007 Just a suggestion, but echoing only one of potentially multiple errors and forcing your users to click to go back is an interface nightmare. It's cumbersome and likely to frustrate people. Why not set your form up so that if there are errors it automatically re-displays the form, resets all of the fields to what the user initially chose, and displays all of the error messages on the top? Quote Link to comment https://forums.phpfreaks.com/topic/70509-solved-if-help/#findComment-354209 Share on other sites More sharing options...
darkfreaks Posted September 24, 2007 Share Posted September 24, 2007 yeah thats how i do my forms i make it so if something is not entered it doesnt submit Quote Link to comment https://forums.phpfreaks.com/topic/70509-solved-if-help/#findComment-354215 Share on other sites More sharing options...
phpcode Posted September 24, 2007 Author Share Posted September 24, 2007 Thanks did it also what does the exclamation mark before the word empty do? Quote Link to comment https://forums.phpfreaks.com/topic/70509-solved-if-help/#findComment-354244 Share on other sites More sharing options...
BlueSkyIS Posted September 24, 2007 Share Posted September 24, 2007 it means "not" Quote Link to comment https://forums.phpfreaks.com/topic/70509-solved-if-help/#findComment-354263 Share on other sites More sharing options...
phpcode Posted September 24, 2007 Author Share Posted September 24, 2007 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/70509-solved-if-help/#findComment-354271 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.