title: MySQL and PHP help on how to make a registration form
body: <p>Hi I am trying to make a registration form that sends input data to phpmyadmin's database I created.  I think I mixed up MySQLI and MySQL any suggestions on how to fix would be great!! I just dont understand why my data is not being sent over to the database on phpmyadmin.</p>
  
  <p>PHP: 
      
  
  <pre><code>// connect to database
  $db = mysqli_connect("127.0.0.1", "root", "", "user logins");
  
  if (isset($_POST['register_btn'])) {
      $firstName = mysql_real_escape_string($_POST['firstName']);
      $lastName = mysql_real_escape_string($_POST['lastName']);
      $emailAddress = mysql_real_escape_string($_POST['emailAddress']);
      $password = mysql_real_escape_string($_POST['password']);
      $password2 - mysql_real_escape_string($_POST['password2']);
  }
  
  if ($password == $password2) {
      // create user
      $password = md5($password); //hash password before storing for security
      $sql = "INSERT INTO user logins(firstName, lastName, emailAddress, password) VALUES('$firstName', '$lastName' '$emailAddress', '$password')";
      mysqli_query($db, $sql);
      $_SESSION['message'] = "You are now logged in";
      $_SESSION['username'] = $username;
      header('location: homepage.html'); //redirect to homepage
  } else {
      $_SESSION['message'] = "The two passwords do not match";
  }
  ?&gt;
  </code></pre>
  
  <p>HTML: </p>
  
  <pre><code>&lt;link rel="stylesheet" type="text/css" href="custom.css"&gt;
  
  &lt;body class="background"&gt;
  &lt;div&gt;
      &lt;h1 class="header1"&gt;Sign in Below&lt;/h1&gt;
  &lt;/div&gt;
  &lt;div&gt;
      &lt;form action="connect.php" method="post"&gt;
          &lt;div&gt;
              &lt;label for="firstName"&gt;First Name:&lt;/label&gt;
              &lt;input type="text" name="first_name" id="firstName"&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;label for="lastName"&gt;Last Name:&lt;/label&gt;
              &lt;input type="text" name="last_name" id="lastName"&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;label for="emailAddress"&gt;Email Address:&lt;/label&gt;
              &lt;input type="email" name="email" id="emailAddress"&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;label for="password"&gt;Password:&lt;/label&gt;
              &lt;input type="password" name="password" id="password"&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;label for="password2"&gt;Repeat Password:&lt;/label&gt;
              &lt;input type="password" name="password2" id="password2"&gt;
          &lt;/div&gt;
          &lt;input type="submit" name="register_btn" value="register"&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>