MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.141.42.41
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/ppcad7no/public_ftp/../deedeecreation.in/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/public_ftp/../deedeecreation.in/cart.php
<?php
    session_start();
    include_once('admin/config.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cart - Dee Dee Creation</title>

    <?php include 'top-link.php';?>
    <style>
        .error{
            color:#f7748c;
        }
    </style>
</head>
<body>
<?php include 'header.php';?>
<section class="nav-burger py-3">
    <div class="container">
        <div class="row">
            <div class="col">
                <h2 class="text-center">CHECK OUT</h2>
                <p class="text-center"><a href="<?php echo $wspath?>">Home </a><span> /</span> Check Out </p>
            </div>
        </div>
    </div>
</section>
<section class="check-out mt-2 py-5">
    <div class="container">
        <div class="row">
            <?php if (isset($_SESSION['cart']) && !empty($_SESSION['cart'])) : ?>
            <div class="col-md-6">
            
                <?php
                    // print_r($_SESSION['cart']);exit;
                  $counter = 1; // Counter for serial numbers
                  $total = 0;
                  foreach ($_SESSION['cart'] as $key => $value) {
                    echo '<div style="margin: auto;" class="col-12">
            <div class="check-box">
                <div class="row">
                    <div class="col-6">
                        <div class="image-box">
                            <img  class="img-fluid" src="'.$wspath.'admin/images/'.$value['img1'].'" alt="product">
                        </div>
                    </div>
                    <div style="margin: auto;" class="col-6">
                    <div class="detail-box mt-3">
                        <div class="row">
                            <div class="col-6"><p>Design :</p></div>
                            <div class="col-6"><p>'.$value['name'].'</p></div>
                        </div>
                        <div class="row">
                            <div class="col-6"><p>Size :</p></div>
                            <div class="col-6"><p>'.$value['size'].'</p></div>
                        </div>
                        <div class="row">
                            <div class="col-6"><p>Rate :</p></div>
                            <div class="col-6"><p>'.$value['rate'] .'</p></div>
                        </div>
                    </div>
                    <td>
                              <form action="add.php" method="POST"> 
                                <button name="remove_product" value="' . $key . '" class="btn btn-sm btn-outline-info">Remove</button> <!-- Pass the key as the value to remove the specific item -->
                                <input name="item_name" type="hidden" value="' . $value['name'] . '">
                              </form>
                            </td>
                    </div>
                    </div>
            </div>
          </div>';
                  }
                  ?>
                <div class="row print-button-row">
            <div class="col-12 text-center mt-4">
                <!--<button id="printButton" class="btn btn-primary"><i class="fa-solid fa-print"></i> Print</button>-->
                <!--<button id="generatePDFButton" name="generatePDFButton" class="btn btn-secondary"><i class="fa-solid fa-file-pdf"></i> Generate PDF</button>-->
            </div>
        </div>
          <!-- ...add new... -->
          <!--<div style="    margin: auto;" class="col-12">-->
          <!--  <div class="check-box">-->
          <!--      <div class="row">-->
          <!--          <div class="col-6">-->
          <!--              <div class="image-box">-->
          <!--                  <img  class="img-fluid" src="img/basic1.jpg" alt="product">-->
          <!--              </div>-->
          <!--          </div>-->
          <!--          <div style="margin: auto;" class="col-6">-->
          <!--          <div class="detail-box mt-3">-->
          <!--              <div class="row">-->
          <!--                  <div class="col-6"><p>Design :</p></div>-->
          <!--                  <div class="col-6"><p>2451487</p></div>-->
          <!--              </div>-->
          <!--              <div class="row">-->
          <!--                  <div class="col-6"><p>Size :</p></div>-->
          <!--                  <div class="col-6"><p>2 X 40</p></div>-->
          <!--              </div>-->
          <!--              <div class="row">-->
          <!--                  <div class="col-6"><p>Rate :</p></div>-->
          <!--                  <div class="col-6"><p>400-450</p></div>-->
          <!--              </div>-->
          <!--          </div>-->
          <!--          </div>-->
          <!--      </div>-->
          <!--  </div>-->
          <!--</div>-->
          <!-- ...add new... -->
          
            </div>
            <div class="col-md-6">
                <div style="margin: auto;display: block;" class="col-12">
                    <div class="enquiry-box">
                        <h1 class="text-center">Fill Your Details</h1>
                            <?php
                            // print_r($_SESSION['cart']);
                            ?>
                        <form method="post" action="send.php" onsubmit="return validateForm()">
                            <div class="mb-3">
                                <label for="exampleInputName" class="form-label">Full Name</label>
                                <input type="text" class="form-control" name="cust_name" id="nameInput" required>
                                <span id="nameError" class="error"></span>
                            </div>
                            <div class="mb-3">
                                <label for="exampleInputName" class="form-label">Contact Number</label>
                                <input type="text" class="form-control" aria-describedby="nameHelp" name="phone" id="phone_no" minlength="10" maxlength="10" onkeypress="return isNumberKey(event)" pattern=".{10,10}" onpaste="return false;" required>
                                <span id="phoneError" class="error"></span>
                            </div>
                            <div class="mb-3">
                                <label class="form-label">Email Address</label>
                                <input type="email" class="form-control" aria-describedby="emailHelp" name="email" id="emailInput" required>
                                <span id="emailError" class="error"></span>
                            </div>
                            <div class="mb-3">
                                <label class="form-label">City</label>
                                <input type="text" class="form-control" name="city" id="cityInput" required>
                                <span id="cityError" class="error"></span>
                            </div>
                            <div class="mb-3">
                                <label class="form-label">Address</label>
                                <textarea class="form-control" name="address" required></textarea>
                            </div>
                          <?php
                    // print_r($_SESSION['cart']);exit;
                  $counter = 1; // Counter for serial numbers
                  $total = 0;
                  foreach ($_SESSION['cart'] as $key => $value) {
                          echo'<input name="sr_no" value="'.$value['p_id'].'" hidden>
                          <input name="name" value="'.$value['name'].'" hidden>
                          <input name="price" value="'.$value['rate'] .'" hidden>
                          <input name="image" value="'.$value['img1'].'" hidden>
                          <input name="size" value="'.$value['size'].'" hidden>
                          ';
                         } ?>
                         <button type="submit" class="btn btn-primary" name="generatePDFButton">Submit</button>
                        </form>
                    </div>
                </div>
            </div>
        
        <?php else : ?>
              <h2 class="text-center" style="color:red;">No items in the cart.</h2>
              <div class="checkout_btn_inner float-right text-center">
                <a class="btn" href="<?php echo $wspath?>" style="border: 2px solid #caa264; color: green;"><h3>Continue Shopping</h3></a>
              </div>
            <?php endif; ?>
            </div>
    </div>
</section>
<script>
function isNumberKey(evt) {
    // Your isNumberKey function code here
}

function validateForm() {
    const name = document.getElementById("nameInput").value;
    const email = document.getElementById("emailInput").value;
    const phone = document.getElementById("phone_no").value;
    const city = document.getElementById("cityInput").value;
    
    const namePattern = /^[A-Za-z\s]+$/;
    const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
    const phonePattern = /^\d{10}$/;
    const cityPattern = /^[A-Za-z\s]+$/;

    let isValid = true;

    if (!name.match(namePattern)) {
        document.getElementById("nameError").textContent = "Please enter a valid name use only Alphabet";
        isValid = false;
    } else {
        document.getElementById("nameError").textContent = "";
    }

    if (!email.match(emailPattern)) {
        document.getElementById("emailError").textContent = "Please enter a valid email address";
        isValid = false;
    } else {
        document.getElementById("emailError").textContent = "";
    }

    if (!phone.match(phonePattern)) {
        document.getElementById("phoneError").textContent = "Please enter a valid 10-digit phone number";
        isValid = false;
    } else {
        document.getElementById("phoneError").textContent = "";
    }

    if (!city.match(cityPattern)) {
        document.getElementById("cityError").textContent = "Please enter a valid city name";
        isValid = false;
    } else {
        document.getElementById("cityError").textContent = "";
    }

    return isValid;
}
</script>
<script>
    document.getElementById("printButton").addEventListener("click", function() {
        window.print();
    });

    document.getElementById("generatePDFButton").addEventListener("click", function() {
        window.location.href = 'send.php'; // Redirect to generate-pdf.php
    });
</script>

<?php include 'footer.php';?>
</body>
</html>

MMCT - 2023