Jump to content

[SOLVED] If help


phpcode

Recommended Posts

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

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

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.