title: When the user did not fill up all the blanks or fill in wrongly, how to validate them and bring it back to the same form?
body: <p>This is by Newcustomer.php form whereby i click on the button next, it will proceed to the next form which is NewExpertise.php. </p>
  
  <pre><code>&lt;form action = NewExpertise.php method="post"&gt;
      &lt;?php
      include('CSS.php');
      include('DB.php');
      ?&gt;
      &lt;span class =wordtab&gt;Name&lt;/span&gt; &lt;input name = newname id = 'newname' type='text'/&gt; &lt;br&gt;
      &lt;span class =wordtab&gt;IC&lt;/span&gt;&lt;input name = newic id = 'newic' type='text'/&gt;&lt;br&gt;
      &lt;span class =wordtab&gt;Number&lt;/span&gt;&lt;input name = newnumber id = 'newnumber' type='text'/&gt;&lt;br&gt;
      &lt;span class =wordtab&gt;Nationality&lt;/span&gt;&lt;input name = newnationality id = 'newnationality' type='text'/&gt;&lt;br&gt;
      &lt;span class =wordtab&gt;Status&lt;/span&gt;
      &lt;select name = 'newstatus' id = newstatus&gt;
          &lt;option value="Interested"&gt;Interested&lt;/option&gt;
          &lt;option value='Not Interested'&gt;Not Interested&lt;/option&gt;
      &lt;/select&gt;&lt;br&gt;
  
      &lt;span class =wordtab&gt;Remarks&lt;/span&gt;&lt;input name = newremarks id = 'newremarks' type='text'/&gt;&lt;br&gt;
      &lt;?php
  
      ?&gt;
      &lt;br&gt;&lt;br&gt;
  
      &lt;input type="submit" id="Next" name="Next" value = "Next" &gt;
      &lt;br&gt;&lt;br&gt;
      &lt;input type="button" onclick="location.href='index.php';" value="Back to CRM" /&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>This are my codes from newexpertise.php. It shows an sql to insert the new customer into my database. However i did a validation whereby if the textboxes are empty, i want it to go back to newcustomer.php and prompt them what fields are missing. If possible, how can i also validate fields whereby user and only type in numeric values in number textbox for example. Thank you so much. 
      
  
  <pre><code>    if(isset($_POST['Next']))
      {
          if($_POST['newname']==""||$_POST['newic']==""||$_POST['newnumber']==""||$_POST['newnationality']==""||$_POST['newstatus']==""||$_POST['newremarks']=="")
          {
              $message = "Please fill in the all the relevant data";
              echo "&lt;script type='text/javascript'&gt;alert('$message');&lt;/script&gt;";
  
          }
  
          else
          {
  
              $addquery = "INSERT INTO Particulars (Particulars_ID, Name, Identification_Number, Number, Nationality, Status, Remarks)
                      VALUES(LAST_INSERT_ID(),'$_POST[newname]', '$_POST[newic]','$_POST[newnumber]','$_POST[newnationality]','$_POST[newstatus]','$_POST[newremarks]')";
              if ($connect-&gt;query($addquery) === TRUE)
              {
                      $last_id = $connect-&gt;insert_id;
  
  
              }
  
  
              else 
              {
                  echo "Error updating record: " . $connect-&gt;error;
              }
  
          }
      }
  
  
      ?&gt;
  </code></pre>