Jump to content
Larry Ullman's Book Forums

iamconfused

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by iamconfused

  1. Thank you for your response! I think I just get really confused when writing IF/IF-ELSE statements.
  2. "Rewrite the password conditionals found in register.php as a nested pair of conditionals." Why do the password conditionals need to be rewritten to be as a nested pair of conditionals when the un-nested conditionals seemed to be the simpler solution? I'm not even sure if the solution I came up with is the right one. Original un-nested password conditionals: if (empty($_POST['password1'])) { $problem = true; print '<p class="text--error">Please enter a password!</p>'; } if ($_POST['password1'] != $_POST['password2']) { $problem = true; print '<p class="text--error">Your password did not match your confirmed password!</p>'; } Here's what I have: if ( (empty($_POST['password1'])) OR (empty($_POST['password2'])) OR ($_POST['password1'] != $_POST['password2']) ) { #nest password conditionals if ( empty($_POST['password1']) OR (empty($_POST['password2'])) ) { print '<p class="text--error">Please enter a password and/or confirm your password!</p>'; } if ($_POST['password1'] != $_POST['password2']) { print '<p class="text--error">Your password did not match your confirmed password!</p>'; } $problem = true; } Am I on the right track or am I over complicating things?
×
×
  • Create New...