Jump to content
Larry Ullman's Book Forums


  • Posts

  • Joined

  • Last visited

Everything posted by dino2007

  1. I am scratching my head over this task. I am quite clueless at this point. I would appreciate help on this. Rewrite the gender conditional in handle_form.php (Script 2.4) as one conditional instead of two nested ones. Hint: You’ll need to use the AND operator. Here is the nested conditional: <?php if (isset ($_POST['gender'])) { $gender = $_POST['gender']; if ($gender == 'M') { $greeting = '<p><b>Good day, Sir!</b></p>'; } elseif ($gender == 'F') { $greeting = '<p><b>Good day, Madam!</b></p>'; } } else { $gender = NULL; echo '<p class="error">Gender should be either "M" or "F"!</p>'; }
  • Create New...