title: checking to see if a text box is empty in php
body: <p>I have a php/html from where the user enters a number of values which are then updated into a database by using mysqli and a insert query, If the user does not enter anything into any of the text boxes I want a message to appear saying that the information is not there, I have tried using </p>
  
  <pre><code>if($ownerName == "" ){
      echo("Missing Information!"); 
  </code></pre>
  
  <p>but it won't work. </p></p>
  
  <p>Here is my php code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  
  include "connect.php";
  if($_POST["submit"])
  {
      $ownerName = $_POST['OwnerName'];
      $location = $_POST['Location'];
      $phoneNumber = $_POST['PhoneNumber'];
  
     if($ownerName == "" || $location == "" || $phoneNumber == ""){
      echo("Missing Information!");
  
      /*if(is_numeric($phoneNumber) ){
                          settype($phoneNumber, "integer");
              }*/
   
  
      $query = "INSERT INTO OWNER VALUES ('$ownerName','$location', $phoneNumber)";
  
  
  
  
      if (!mysqli_query($con,$query))
      {
          die('Error: ' . mysqli_error($con));
      }
      echo "&lt;script type='text/javascript'&gt;alert('1 record added')&lt;/script&gt;";
      
  
      mysqli_close($con); 
  }
  ?&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is my form</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;&lt;head&gt;&lt;title&gt;Connect to Database&lt;/title&gt;&lt;/head&gt;&lt;body&gt; 
  
  &lt;font size="4"&gt; Enter owner details&lt;/font&gt;&lt;br&gt;&lt;br&gt; 
  &lt;form action="update.php" method="post" &gt;
  
  Owner Name:&lt;input  type="text" name="OwnerName"&gt; 
  Location: &lt;input  type="text" name="Location"&gt; 
  Phone Number:&lt;input  type="text" name="PhoneNumber"&gt; 
  &lt;input type="submit" name = "submit" value="Submit Value"&gt; 
  &lt;/form&gt;&lt;/body&gt;&lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>