title: Sending Variables to MySQLi
body: <p>i have been staring at this page for half an hour trying to figure out where i am going wrong. The first two variables are found and inserted into database, however the last two, 'email' and 'password' are not found, not inserted into database but still however pass the if statement. Any help will be much appreciated.</p>
  
  <p>Form.php</p>
  
  <pre><code>        &lt;form name="signup" method="POST" action="signup.php"&gt;
  
          &lt;label for="signupFirstName"&gt;First Name&lt;/label&gt;
          &lt;input type="text" id="signupFirstName" name="signupFirstName" /&gt;
          &lt;label for="signupLastName"&gt;Last Name&lt;/label&gt;
          &lt;input type="text" id="signupLastName" name="signupLastName"/&gt;
  
          &lt;label for="signupEmail"&gt;Email&lt;/label&gt;
          &lt;input type="text" id="signupEmail" name="signupEmail" /&gt;
          &lt;label for="signupConfirmEmail"&gt;Confirm Email&lt;/label&gt;
          &lt;input type="text" id="signupConfirmEmail" name="signupConfirmEmail"/&gt;
  
          &lt;label for="signupPassword"&gt;Password&lt;/label&gt;
          &lt;input type="text" id="signupPassword" name="signupPassword"/&gt;
          &lt;label for="signupConfirmPassword"&gt;Confirm Password&lt;/label&gt;
          &lt;input type="text" id="signupConfirmPassword" name="signupConfirmPassword"/&gt;
  
          &lt;button name="submit" type="submit" &gt;Submit Form&lt;/button&gt;
  
          &lt;/form&gt;
  </code></pre>
  
  <p>signup.php</p>
  
  <pre><code>     &lt;?php
      if (isset($_POST['signupFirstName']) || isset($_POST['signupLastName']) ||     isset($_POST['signupEmail']) || isset($_POST['signupPassword']) ) {
  
      echo $_POST['signupEmail'];
      $mysqli = new mysqli('localhost', 'user1', 'password', 'db2');
  
      /* check connection */
      if (mysqli_connect_errno()) {
      printf("Connect failed: %s\n", mysqli_connect_error());
      exit();
      }
  
      $stmt = $mysqli-&gt;prepare("INSERT INTO members (First_Name, Last_Name, Email, Password) VALUES (?,?,?,?)");
      $stmt-&gt;bind_param('ssss',$sample,$lastName,$email,$password);
  
  
      // escape the POST data for added protection
      $sample = isset($_POST['signupFirstName'])
          ? $mysqli-&gt;real_escape_string($_POST['signupFirstName'])
          : '';
      $lastName = isset($_POST['signupLastName'])
          ? $mysqli-&gt;real_escape_string($_POST['signupLastName'])
          : '';     
      $email = isset($_POST['signupEmail'])
          ? $mysqli-&gt;real_escape_string($_POST['signupEmail'])
          : '';
      $password = isset($_POST['signupPassword'])
          ? $mysqli-&gt;real_escape_string($_POST['signupPassword'])
          : '';
  
  
      /* execute prepared statement */
      $stmt-&gt;execute();
  
      printf("%d Row inserted.\n", $stmt-&gt;affected_rows);
  
      /* close statement and connection */
      $stmt-&gt;close();
  
      /* close connection */
      $mysqli-&gt;close();
  }
      else{
      echo "broken";
      }
  ?&gt;
  </code></pre>