title: What is wrong with following PHP code portion?
body: <p>I wrote the following code ,</p>
  
  <pre><code>}else if($do=="add"){
  if(isset($_REQUEST["confirm"])){
      $confirm=$_REQUEST["confirm"];  
      if($confirm=="1"){
          if(empty($_POST["name"])){
              header("location:lecturer.php");
          }else{
              $name=$_POST["name"];
          }
          lecturer_add($name);     //Add a lecturer
          header("location:lecturer.php");
      }
  }
  </code></pre>
  
  <p>In the time that the form with following structure submit(with empty 'name' field) it will add an empty record to the database. However it should redirect to lecturer.php</p>
  
  <pre><code>&lt;form action="lecturer.php?do=add&amp;confirm=1" method="post"&gt;
  Name
  &lt;input name="name" type="text" id="name"&gt;
  &lt;br&gt;
  &lt;center&gt;&lt;input type="submit" value="Add"&gt;&lt;/center&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I tried "empty" , "!empty" and "isset".
  I don't know what is wrong and why its not working !:(</p>