title: Mysql database sometimes enter blank rows when submitted via php otherwise it works well. How to avoid this?
body: <p>FORM CODE -</p>
  
  <pre><code>&lt;form method="POST" action="shareexperience.php" id="contactForm"  name="sentMessage" target="formsaved"&gt;
  &lt;br/&gt;&lt;textarea rows="5" cols="40" name="views" id="views" placeholder="Views About Your Profession"&gt;
  &lt;/textarea&gt; &lt;br/&gt;
  &lt;textarea rows="5" cols="40" name="advice" id="advice" placeholder="Advice 4 Students"&gt;
  &lt;/textarea&gt; &lt;br/&gt;
  Wanna Be A Guide 4 Child 
  &lt;input type="radio" id="yes" name="guide" value="Yes" checked&gt; Yes &lt;/input&gt;
  &lt;input type="radio" id="No" name="guide" value="No" &gt; No &lt;/input&gt; 
  &lt;br/&gt;&lt;input type="text" name="name" id="professionalname" placeholder="Name"&gt;
  &lt;input type="text" name="email" id="professionalemail" placeholder="Email Id"&gt; &lt;br/&gt;
  &lt;br/&gt;&lt;input type="submit" value="Share &amp; Nominate" onclick="saveexperience()"&gt; 
  &lt;/form&gt;
  
  
  PHP CODE-
  
  &lt;? php
  $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error()); 
   $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " .mysql_error());
   //inserting Record to the database
   $name = $_POST['name']; 
   $email = $_POST['email'];
  $views = $_POST['views'];
  $advice = $_POST['advice'];
  $guide=$_POST['guide'];
   $query = "INSERT INTO professionals(name,email,views,advice,guide)VALUES('$name','$email', '$views','$advice','$guide')"; 
   $result = mysql_query($query); 
  mysql_close($con); 
  ?&gt;
  </code></pre>
  
  <p>Target formsaved has been used to avoid redirection by using html tag iframe as followed below- </p>
  
  <pre><code>&lt;iframe name="formsaved" height="30px" width="300px" scrolling="no" frameborder="0"&gt; &lt;/iframe&gt;
  </code></pre>
  
  <p>Sometimes data enter fines but sometimes it doesn't work 
  You can check my website as well - guidance4future.in/nominate</p>
  
  <p>Note:- onclick has been used to disable one of the html tags in the page further...</p>
  
  <p>Thanks in advance...</p>