D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
aviscollection.com
/
admin
/
Filename :
manage-customer.php
back
Copy
<?php include'config.php'; include'function.php'; error_reporting(0); $action = $_GET['action']; $action_title = stringModify($action); $item_name = ''; $item_phone = ''; $item_email = ''; $item_password = ''; $item_gender = ''; $item_address = ''; $item_city = ''; $item_pin = ''; $item_state= ''; $item_status = ''; if($action == 'delete_customer'){ $del_id = $_GET['id']; $del_event = mysqli_query($conn, "DELETE FROM `customers` WHERE customer_id = '$del_id'"); if ($del_event) { echo '<script>alert("Customer data deleted.")</script>'; echo '<script> window.location.href = "customers-list.php";</script>'; } } if($action == 'edit_customer'){ $edit_id = $_GET['id']; $view_event = mysqli_query($conn, "SELECT * FROM `customers` WHERE customer_id = '$edit_id'"); while($row = mysqli_fetch_array($view_event)) { $item_id = $row['customer_id']; $item_name = $row['customer_name']; $item_phone = $row['customer_phone']; $item_email = $row['customer_email']; $item_password = $row['customer_password']; $item_gender = $row['customer_gender']; $item_address = $row['customer_address']; $item_city = $row['customer_city']; $item_pin = $row['customer_pin']; $item_state = $row['customer_state']; } } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Admin, Manage Products| <?php echo $company; ?></title> <?php include'style.php'; ?> </head> <body> <!-- Begin page --> <div id="layout-wrapper"> <?php include'header.php'; ?> <div class="main-content"> <div class="page-content"> <div class="container-fluid"> <div class="row"> <div class="col-12"> <div class="page-title-box d-sm-flex align-items-center justify-content-between"> <h4 class="mb-sm-0 font-size-18"><?php echo $action_title; ?></h4> <div class="page-title-right"> <ol class="breadcrumb m-0"> <li class="breadcrumb-item"><a href="./">Admin</a></li> <li class="breadcrumb-item active"><?php echo $action_title; ?></li> </ol> </div> </div> </div> </div> <div class="card"> <div class="card-body p-4"> <div class="row"> <div class="col-lg-8 col-sm-6 col-xs-12"></div> <div class="col-lg-4 col-sm-6 col-xs-12"> <div class="data_img"> <?php if ($item_gender == "male") { echo '<img src="assets/images/man.png" style="height:200px;width: auto;" alt="<?php echo $item_name; ?>_img">'; }elseif ($item_gender == "female") { echo '<img src="assets/images/woman.png" style="height:200px;width: auto;" alt="<?php echo $item_name; ?>_img">'; } ?> </div> </div> <div class="col-lg-12 col-sm-12 col-xs-12"> <form action="" method="POST" enctype="multipart/form-data" > <div class="clearfix"></div> <div class="row"> <div class="col-lg-6 col-sm-12 col-xs-12"> <div class="mb-3"> <label for="example-text-input" class="form-label">customer name:</label> <input class="form-control" type="text" value="<?php echo $item_name; ?>" id="example-text-input" name="item_name" placeholder="customer name" required> </div> <div class="mb-3"> <label for="example-text-input" class="form-label">customer email:</label> <input class="form-control" type="email" value="<?php echo $item_email; ?>" name="item_email" placeholder="customer email" required> </div> <div class="mb-3"> <label for="example-text-input" class="form-label">customer phone:</label> <input class="form-control" type="tel" maxlength="10" value="<?php echo $item_phone; ?>" name="item_phone" placeholder="customer phone"> </div> <div class="mb-3"> <label for="example-text-input" class="form-label">customer password:</label> <input class="form-control" type="text" value="<?php echo $item_password; ?>" name="item_password" placeholder="customer password"> </div> <div class="mb-3"> <label for="example-text-input" class="form-label">customer gender:</label> <input class="form-control" type="text" value="<?php echo $item_gender; ?>" name="item_gender" placeholder="customer gender" required> </div> <div class="mt-4"> <div class="btn_div"> <button type="submit" name="<?php echo $action; ?>" class="btn btn-primary w-md btn_manage"><?php echo $action_title; ?></button> </div> </div> </div> <div class="col-lg-6 col-sm-12 col-xs-12"> <div class="mb-3"> <label for="example-text-input" class="form-label">customer address:</label> <input class="form-control" type="text" value="<?php echo $item_address; ?>" name="item_address" placeholder="customer address" required> </div> <div class="mb-3"> <label for="example-text-input" class="form-label">customer location:</label> <input class="form-control" type="text" value="<?php echo $item_location; ?>" name="item_location" placeholder="customer location" required> </div> <div class="mb-3"> <label for="example-text-input" class="form-label">customer city:</label> <input class="form-control" type="text" value="<?php echo $item_city; ?>" name="item_city" placeholder="customer city" required> </div> <div class="mb-3"> <label for="example-text-input" class="form-label">State pin code:</label> <input class="form-control" type="text" value="<?php echo $item_pin; ?>" name="item_pin" placeholder="Area pin code"> </div> <div class="mb-3"> <label for="example-text-input" class="form-label">product category:</label> <?php $selected = $item_state; $state_list = mysqli_query($conn, "SELECT * FROM state_list"); echo "<select class='form-control' name='item_state'> <option>Select Your State</option>"; if (mysqli_num_rows($state_list) > 0) { while ($state = mysqli_fetch_array($state_list)) { $sname = $state['state_name']; $sid = $state['state_id']; if ($selected == $sid) { echo "<option value='$sid' selected>$sname</option>"; } else{ echo "<option value='$sid'>$sname</option>"; } } echo "</select>"; } echo "</select>"; ?> </div> </div> </div> </form> </div> </div> </div> </div> </div> </div> <?php include'right-sidebar.php'; ?> <?php include'script.php'; ?> </body> </html> <?php // if (isset($_POST['add_product'])) { // $item_id = $row['customer_id']; // $item_name = $row['customer_name']; // $item_email = $row['customer_email']; // $item_gender = $row['customer_gender']; // $item_address = $row['customer_address']; // $item_city = $row['customer_city']; // $item_pin = $row['customer_pin']; // $item_state = $row['customer_state']; // $item_status = $_POST['item_status']; // if ($_POST['item_status'] != '') {$item_status = $_POST['item_status'];} // else{ $item_status = 0;} // $uploaddir = 'product-images'; // if(!is_dir($uploaddir)){ // mkdir($uploaddir); // } // $item_img = $_FILES['item_img']['name']; // $item_tmp = $_FILES['item_img']['tmp_name']; // $item_path = $uploaddir ."/". $item_img; // if(move_uploaded_file($item_tmp, $item_path)){ // echo $insrt_item = "insert into products(product_id, product_name, product_price, product_cut_price, product_model, product_brand, product_waranty, product_content, product_img, product_category, product_status) values('', '$item_name', '$item_price', '$item_cut_price', '$item_model', '$item_brand', '$item_waranty', '$item_content', '$item_img', '$item_category', '$item_status')"; // $run_query = mysqli_query($conn, $insrt_item) or die(mysqli_error($conn)); // if ($run_query){ // echo '<script>alert("Product data uploaded.")</script>'; // // echo '<script> window.location.href = "travel-packages.php";</script>'; // } // else{ // echo '<script>alert("Product data not uploaded.")</script>'; // } // } // else{ // echo '<script>alert("Product image not uploaded.")</script>'; // } // } if (isset($_POST['edit_customer'])) { $item_name = $_POST['item_name']; $item_phone = $_POST['item_phone']; $item_email = $_POST['item_email']; $item_gender = $_POST['item_gender']; $item_address = $_POST['item_address']; $item_city = $_POST['item_city']; $item_pin = $_POST['item_pin']; $item_state = $_POST['item_state']; // $itemImg_Condition = ''; echo $update_item = "UPDATE `customers` SET `customer_name`='$item_name',`customer_phone`='$item_phone',`customer_email`='$item_email',`customer_gender`='$item_gender',`customer_address`='$item_address',`customer_city`='$item_city', `customer_pin`='$item_pin',`customer_state`='$item_state' WHERE `customer_id` = '$edit_id'"; $run_query = mysqli_query($conn, $update_item) or die(mysqli_error($conn)); if ($run_query){ echo '<script>alert("Customer Data edited.")</script>'; echo '<script> window.location.href = "customers-list.php";</script>'; } else{ echo '<script>alert("Customer Data not edited.")</script>'; } } ?>