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? 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";} 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. 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 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? 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 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? 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" 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 Link to comment https://forums.phpfreaks.com/topic/70509-solved-if-help/#findComment-354271 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.