title: Save login form data using php
body: <p><a href="https://i.stack.imgur.com/yaU1s.png" rel="nofollow noreferrer">html webpage screenshot</a><a href="https://i.stack.imgur.com/zu6uh.png" rel="nofollow noreferrer">php code shown on button click</a><a href="https://i.stack.imgur.com/qE5yN.png" rel="nofollow noreferrer">mySql database table</a>I need to store user login data. i am using phpMyAdmin. When I click on submit button, data is not stored. Instead the php code is shown. Both code files are given below. What I am doing wrong. Help me. I 
  am unable to store user data using phpmyadmin in xampp.</p>
  
  <p>my html code</p>
  
  <pre><code>
      &lt;html&gt;
      &lt;head&gt;
      &lt;title&gt;Yahoo Signin And Signup Form&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
       &lt;h2 style="color: midnightblue"&gt;yahoo!&lt;/h2&gt;
       &lt;hr color="magenta"&gt;
      &lt;form method="post" action="connect.php" &gt;
      &lt;fieldset style="background:#6495ED;"&gt;
      &lt;legend style="padding:20px 0; font-size:20px;"&gt;Signup:&lt;/legend&gt;
      &lt;label for ="firstName"&gt;Enter First Name&lt;/label&gt;&lt;br&gt;
      &lt;input type="text" placeholder="First name" id="firstName" name ="firstName"&gt; 
      &lt;br&gt;
      &lt;label for ="lastName"&gt;Enter Last Name&lt;/label&gt;&lt;br&gt;
      &lt;input type="text" placeholder="Last name" id="lastName" name ="lastName"&gt; 
      &lt;br&gt;
      &lt;label for ="email"&gt;Enter Email&lt;/label&gt;&lt;br&gt;
      &lt;input type="text" placeholder="Email" id="email" name ="email"&gt;&lt;br&gt;
      &lt;label for ="password"&gt;Enter Password&lt;/label&gt;&lt;br&gt;
      &lt;input type="password" placeholder="Password" id="password" name ="password"&gt; 
      &lt;br&gt;
      &lt;label for ="number"&gt;Enter Mobile Number&lt;/label&gt;&lt;br&gt;
      &lt;input placeholder="03---" id="number" name ="number"&gt;&lt;br&gt;
      &lt;label for ="date"&gt;Enter Date of Birth&lt;/label&gt;&lt;br&gt;
      &lt;input type="text" placeholder="DD/MM/YY" id="date" name ="date"&gt;&lt;br&gt;
      &lt;label for ="gender"&gt;Enter Gender&lt;/label&gt;&lt;br&gt;
      &lt;input type="text" placeholder="Male/Female/Other" id="gender" name 
      ="gender"&gt;&lt;br&gt;
      &lt;br&gt;&lt;button style="background-color:orangered;border- 
      color:dodgerblue;color:lightyellow"&gt;Signup&lt;/button&gt;
      &lt;/fielsdet&gt;
      &lt;/form&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>my <code>connect.php</code></p>
  
  <pre><code>    &lt;?php
      $firstName = $_POST['firstName'];
      $lastName = $_POST['lastName'];
      $email = $_POST['email'];
      $password = $_POST['password'];
      $number = $_POST['number'];
      $date = $_POST['date'];
      $gender = $_POST['gender'];
  
      // Making Connection with database
  
      $con = new mysqli('localhost','root','','phpdata');
      if ($con -&gt; connect_error) {
      die('Connection failed :'.$conn -&gt; connect_error);
      }
      else{
      $stmt = $con-&gt;query("INSERT INTO signup(firstName, lastName, email, password, 
      number, date, gender)
          values(?,?,?,?,?,?,?)");
      $stmt-&gt;bind_param("ssssiss",$firstName, $lastName, $email, $password, 
      $number, $date, $gender);
      $stmt-&gt;execute();
      echo "Sign up successful";
      $stmt-&gt;close();
      $con-&gt;close();
       }?&gt;
  </code></pre>