title: PHP form either one of two text fields required
body: <p>I realize there are similar threads regarding .asp pages, however I am using an html form with php involved with the submit action leading into a survey.</p>
  
  <p>The client I am developing for would like either one of the text fields to be filled out, while neither one is hard required one of the two must be filled out.  It can be either of the two, however both cannot be left blank.</p>
  
  <p>I would prefer to not use jquery, however if this is necessary I will learn how.  I am brand new to all of this and just creating the form and connecting it to the database took a whole lot of learning lol.</p>
  
  <p>Thank you for any help, below I have posted the HTML form, and the php script it is linked to.</p>
  
  <pre><code>&lt;form action="insert.php" method="post"&gt;
  Name: &lt;input type="varchar" name="name" /&gt;
  &lt;span style="color: #F00"&gt;or&lt;/span&gt; Email:
  &lt;input type="varchar" name="email" /&gt;
  &lt;input type="submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The PHP 'insert.php</p>
  
  <pre><code>&lt;?php
  $con = mysql_connect("localhost","gobagtoo_1","1");
  if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
  
  mysql_select_db("gobagtoo_1", $con);
  
  $sql="INSERT INTO name_email (name, email)
  VALUES
  ('$_POST[name]','$_POST[email]')";
  
  if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
  else 
  $url = 'tool.html';
  echo '&lt;META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'"&gt;';  
  
  mysql_close($con)
  ?&gt;
  </code></pre>
  
  <p>M</p>