<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Personal Detail</title>

    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css"
    />
    <link rel="stylesheet" href="../css/page2.css" />
  </head>

  <body>
    <div class="container">
      <div class="back">
        <i class="fa-solid fa-arrow-left"></i>
      </div>
<!-- Banner -->
<div class="banner">
  <div class="banner-text">
    <h1>Profile Details</h1>
    <p class="subtitle">
      Complete Your Personal Details Essential information required to tailor
      your experience.
    </p>
  </div>

  <div class="banner-img">
    <img src="../image/profile.png" alt="Profile" />
  </div>
</div>

    <form class="content" action="" method="POST">
      <!-- Inputs -->
      <div class="input-group">
        <i class="fa-regular fa-user"></i>
        <input type="text" name="name" placeholder="Full Name" />
      </div>

      <div class="input-group">
        <i class="fa-solid fa-phone"></i>
        <input type="tel" name="phone" placeholder="Contact Number" />
      </div>

      <div class="input-group">
        <i class="fa-solid fa-location-dot"></i>
        <input type="text" name="address" placeholder="Address" />
      </div>

      <div class="input-group">
        <i class="fa-solid fa-city"></i>
        <input type="text" name="city" placeholder="City" />
      </div>

      <div class="input-group">
        <i class="fa-solid fa-map-pin"></i>
        <input type="text" name="pincode" placeholder="Pincode" />
      </div>

      <button class="btn" type="submit" name="submit">Continue</button>

      <p class="terms">
        “By <span>clicking Continue</span>, you agree to our Terms of Service.”
      </p>
      </form>
    </div>
  </body>
</html>
<?php
    error_reporting(0);
    include('connection.php');
    $name = $_POST['name'];
    $phone = $_POST['phone'];
    $address = $_POST['address'];
    $city = $_POST['city'];
    $pincode = $_POST['pincode'];
    

    if(isset($_POST['submit']))
    {
      $sql = "INSERT INTO `user` (`name`, `phone`, `address`, `city`, `pincode`) VALUES ('$name', '$phone', '$address', '$city', '$pincode')";
      $res = mysqli_query($con,$sql);
      if($res){
        $id = mysqli_insert_id($con);
        echo "
        <script>
        window.location.href = 'page3.php?id=".$id."';
        </script>
        ";
      }
      else{
        echo "not done";
      }
    }
    ?>