title: Executing query through HTML form
body: <p><strong>views/registration.php</strong></p>
  
  <pre><code>&lt;form action="classes/registration.php" method="post"&gt;
  Username: &lt;input type="text" name="username"&gt;&lt;br&gt;
  Password: &lt;input type="text" name="password"&gt;&lt;br&gt;
  &lt;input type="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>classes/registration.php</strong></p>
  
  <pre><code>if(isset($_POST['submit']))
  {
   // Define form variables
   $username = $_POST['username'];
   $password= $_POST['password'];
  
   // Insert form data into database
   $query = "INSERT INTO users (username, password)
   VALUES ('$username', '$password')";
   if(mysqli_query($conn, $query))
   {
      echo "Registration successfull.";
   }
  }
  </code></pre>
  
  <p>The problem is, when I click submit, I get a blank page. The query isn't being executed.</p>
  
  <p>I thought the problem might be because my values aren't setup correctly, so I did the following:</p>
  
  <pre><code>VALUES ('$_POST['password']', '$_POST['password']')";
  </code></pre>
  
  <p>but that gives me an error, presumably because I am using ' inside of '</p>
  
  <p>So now I am back to square one, unsure of why my query isn't being executed</p>