ok
Direktori : /home2/selectio/public_html/frames-hub/ |
Current File : /home2/selectio/public_html/frames-hub/add-customer.php |
<?php include 'header.php'; ?> <?php if(isset($_POST['customer_add_form'])) { $valid = 1; if($valid==1) { $statement = $pdo->prepare("SELECT * FROM customer where cust_phone='".$_POST['mobile']."'"); $result=$statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); if($totalData>0){ echo ("<script LANGUAGE='JavaScript'> window.alert('This Customer Mobile No Already Exiet'); </script>"); }else{ $statement = $pdo->prepare("INSERT INTO customer (cust_firstname,cust_lastname,email,cust_phone,client_id) VALUES (?,?,?,?,?)"); $statement->execute(array($_POST['first_name'],$_POST['last_name'],$_POST['email'],$_POST['mobile'],1)); $id = $pdo->lastInsertId(); unset($_POST['first_name']); unset($_POST['last_name']); unset($_POST['email']); unset($_POST['mobile']); $url="https://selectionsilks.com/frames-hub/frames-add.php?id=".$id; echo ("<script LANGUAGE='JavaScript'> window.alert('Customer Added Successfully'); window.location.href='".$url."' </script>"); } } } ?> <div class="page-wrapper"> <div class="page-content"> <div class="row"> <div class="col-md-12"> <?php if($error_message): ?> <div class="callout callout-danger"> <p> <?php echo $error_message; ?> </p> </div> <?php endif; ?> <?php if($success_message): ?> <div class="callout callout-success"> <p><?php echo $success_message; ?></p> </div> <?php endif; ?> </div> </div> <div class="row"> <form method="post" enctype="multipart/form-data"> <div class="col-lg-12"> <div class="card" style="background-color: #a6c799;border-radius: 19px;box-shadow: 2px 2px 2px 2px currentColor;"> <div class="card-body"> <div class="row g-3"> <div class="col-12 col-lg-12"> <b style="font-weight: bolder;font-size: 17px;">Add Customer</b> <hr> </div> <div class="col-12 col-lg-3"> <label for="FisrtName" class="form-label required">Customer First Name</label> <input type="text" class="form-control" id="first_name" name="first_name" placeholder="First Name" required> </div> <div class="col-12 col-lg-3"> <label for="Last Name" class="form-label required">Customer Last Name</label> <input type="text" class="form-control" id="last_name" name="last_name" placeholder="Last Name"> </div> <div class="col-12 col-lg-3"> <div class="mb-3"> <label class="form-label">Email</label> <input type="email" name="email" class="form-control" placeholder="Email ID"> </div> </div> <div class="col-12 col-lg-3"> <div class="mb-3"> <label class="form-label required">Customer Phone</label> <input type="tel" name="mobile" class="form-control" placeholder="Mobile No" required> </div> </div> </div> <div class="col"> <center><button type="submit" class="btn btn-primary px-5" name="customer_add_form">Save Details</button></center> </div> </div> </div> </div> </form> </div><br> <div class="row"> <div class="col-12"> <a href="customers.php"><center><button type="submit" class="btn btn-warning px-5">Customer List</button></center></a> </div> </div> </div> </div> <?php include 'footer.php'; ?>