title: PHP if null echo else echo
body: <p>Not sure what im doing wrong here, but the out come is always null. The script should output "you did not select an answer" only if no answer was selected but otherwise it should output the answer given:</p>
  
  <p>I have updated the script as mentioned but still getting the empty output even when answer is given :/</p>
  
  <p>Thanks for all the help so far guys, but even the below code doesnt work, it now just outputs as blank if no anwser, but if you do fill it in, it correctly echos the answer.</p>
  
  <pre><code>if (empty( $a1 )) {
  echo"&lt;li&gt;\n&lt;h2&gt;1. " . $q1[0] . "&lt;/h2&gt;\n"
      . "&lt;p&gt;You did not select an answer&lt;/p&gt;\n"
      . "&lt;/li&gt;\n";
  
  }
  
  else {
  
  echo"&lt;li&gt;\n&lt;h2&gt;1. " . $q1[0] . "&lt;/h2&gt;\n"
      . "&lt;p&gt;&lt;strong&gt;" . $q1[$a1] . ":&lt;/strong&gt;&lt;/p&gt;\n"
      . "&lt;p&gt;" . $r1[$a1] . "&lt;/p&gt;\n"
      . "&lt;/li&gt;\n";
  
  }
  </code></pre>
  
  <p>Completely forgot to show this part!!</p>
  
  <pre><code>// get local copies of single answers
  $a1 = trim(isset($_POST['a1'])?$_POST['a1']:99);
  $a3 = trim(isset($_POST['a3'])?$_POST['a3']:99);
  $a4 = trim(isset($_POST['a4'])?$_POST['a4']:99);
  $a5 = trim(isset($_POST['a5'])?$_POST['a5']:99);
  </code></pre>