title: PHP sending blank information to the database
body: <p>I am using a Unity form in conjunction with PHP to send data to a database, I can successfully enter information in and it reaches the database but the problem is it also sends the data if the fields are empty. </p>
  
  <p>I am trying to prevent this using the isset method but it doesn't appear to be working. Can somebody double check this for me?</p>
  
  <p>Image of data reaching the database</p>
  
  <p><a href="https://i.stack.imgur.com/M4CPZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M4CPZ.png" alt="enter image description here"></a></p>
  
  <p>Image of unity form </p>
  
  <p><a href="https://i.stack.imgur.com/rMVyM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rMVyM.png" alt="enter image description here"></a></p>
  
  <pre><code>&lt;?php
  
      if(!isset($_POST['usernamePost'], $_POST['passwordPost'], $_POST['emailPost']))
      {
          echo "This is not working";
      }
      else
      {
      //Enter the data into the database
      $username = filter_var($_POST['usernamePost'], FILTER_SANITIZE_STRING);
      $password = filter_var($_POST['passwordPost'], FILTER_SANITIZE_STRING);
      $email = filter_var($_POST['emailPost'], FILTER_SANITIZE_STRING);
  
      //variable for connection
      $servername = "localhost";
      $server_username = "root";
      $server_password = "";
      $dbName = "ontrigger_game";
  
          try
          {
              //connection to the database
              $dbhandle = mysqli_connect($servername, $server_username, $server_password) 
                or die("Unable to connect to MySQL");
              echo "Connected to MySQL&lt;br&gt;";
  
              //select a database to work with
              $selected = mysqli_select_db($dbhandle, $dbName)
                      or die("Could not select database");
  
              $sql = "INSERT INTO users (username, password, email)
                  VALUES ('".$username."','".$password."','".$email."')";
              if(!mysqli_query($dbhandle, $sql))
              {
                die('Error: ' . mysqli_error());
              }
              echo "1 record added";
  
              //close the connection
              mysqli_close($dbhandle);
  
          } 
          catch (Exception $ex) 
          {
  
          }
      }
  ?&gt;
  </code></pre>