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
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
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.