title: PHP: Inserting Values from the Form into MySQL
body: <p>I created a <code>users</code> table in <code>mysql</code> from the terminal and I am trying to create simple task: insert values from the form. This is my <code>dbConfig file</code> </p>
  
  <pre><code>&lt;?php
  $mysqli = new mysqli("localhost", "root", "pass", "testDB");
  
  /* check connection */
  if (mysqli_connect_errno()) {
      printf("Connect failed: %s\n", mysqli_connect_error());
      exit();
  }
  ?&gt;
  </code></pre>
  
  <p>and This is my <code>Index.php</code> . </p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
   &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt;
      &lt;meta name="description" content="$1"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  
      &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
  
      &lt;title&gt;test&lt;/title&gt;
  
      &lt;?php
      include_once 'dbConfig.php';
      ?&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
       &lt;?php
      if(isset($_POST['save'])){
          $sql = "INSERT INTO users (username, password, email)
          VALUES ('".$_POST["username"]."','".$_POST["password"]."','".$_POST["email"]."')";
      }
  
      ?&gt;
  
      &lt;form method="post"&gt; 
      &lt;label id="first"&gt; First name:&lt;/label&gt;&lt;br/&gt;
      &lt;input type="text" name="username"&gt;&lt;br/&gt;
  
      &lt;label id="first"&gt;Password&lt;/label&gt;&lt;br/&gt;
      &lt;input type="password" name="password"&gt;&lt;br/&gt;
  
      &lt;label id="first"&gt;Email&lt;/label&gt;&lt;br/&gt;
      &lt;input type="text" name="email"&gt;&lt;br/&gt;
  
      &lt;button type="submit" name="save"&gt;save&lt;/button&gt;
      &lt;button type="submit" name="get"&gt;get&lt;/button&gt;
      &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>After hitting my save button, nothing happens, database is still empty. I tried <code>echo'ing</code> the <code>INSERT</code> query and it takes all values from the form as it is supposed to. After I try to check if this worked from terminal, I login into my <code>sql</code> try to return all data from users table and I get empty set.</p>