관리-도구
편집 파일: add-package.php
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <?php include('include/head_admin.php'); $category = ''; $url = ''; $plans = ''; $tours = ''; $dham_yatra = ''; $domestic = ''; $weekend = ''; $name = ''; $title = ''; $short_description = ''; $image = ''; $image_alt_tag = ''; $days = ''; $price = ''; $description = ''; $map = ''; $meta_title = ''; $meta_description = ''; $keyword = ''; $canonical_tag = ''; if (isset($_GET['id']) && $_GET['id'] != '') { $id = get_safe_value($con, $_GET['id']); $image_required = ''; $res = mysqli_query($con, "select * from package where id='$id'"); $check = mysqli_num_rows($res); if ($check > 0) { $row = mysqli_fetch_assoc($res); $id = $_GET['id']; $category = $row['category']; $url = $row['url']; $plans = $row['plans']; $tours = $row['tours']; $dham_yatra = $row['dham_yatra']; $domestic = $row['domestic']; $weekend = $row['weekend']; $name = $row['name']; $title = $row['title']; $short_description = $row['short_description']; $image = $row['image']; $image_alt_tag = $row['image_alt_tag']; $days = $row['days']; $price = $row['price']; $description = $row['description']; $map = $row['map']; $meta_title = $row['meta_title']; $meta_description = $row['meta_description']; $keyword = $row['keyword']; $canonical_tag = $row['canonical_tag']; } else { header('location:all-package.php'); die(); } } ?> </head> <body> <!-- tap on top start --> <div class="tap-top"> <span class="lnr lnr-chevron-up"></span> </div> <!-- tap on tap end --> <!-- page-wrapper start --> <div class="page-wrapper compact-wrapper" id="pageWrapper"> <!-- Page Header Start--> <?php include('include/header_admin.php'); ?> <!-- Page Header Ends--> <!-- Page Body start --> <div class="page-body-wrapper"> <!-- Page Sidebar Start--> <?php include('include/sidebar_admin.php'); ?> <!-- Page Sidebar Ends--> <div class="page-body"> <!-- New package Add Start --> <div class="container-fluid"> <div class="row"> <div class="col-12"> <form class="theme-form theme-form-2 mega-form" action="insert.php" method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-sm-8 m-auto"> <div class="card"> <div class="card-body"> <div class="card-header-2"> <h5>Package Information</h5> </div> <div class="row align-items-center"> <label class="col-sm-3 col-form-label form-label-title">Plans</label> <div class="col-sm-9"> <label class="switch"> <input type="checkbox" name="plans" value="<?php if ($plans == '1') { echo '1'; } else { echo '0'; } ?>" <?php if ($plans == '1') { echo 'checked'; } else { echo ''; } ?>><span class="switch-state"></span> </label> </div> </div> <div class="row align-items-center"> <label class="col-sm-3 col-form-label form-label-title">Tours</label> <div class="col-sm-9"> <label class="switch"> <input type="checkbox" name="tours" value="<?php if ($tours == '1') { echo '1'; } else { echo '0'; } ?>" <?php if ($tours == '1') { echo 'checked'; } else { echo ''; } ?>><span class="switch-state"></span> </label> </div> </div> <div class="row align-items-center"> <label class="col-sm-3 col-form-label form-label-title">Dham Yatra</label> <div class="col-sm-9"> <label class="switch"> <input type="checkbox" name="dham_yatra" value="<?php if ($dham_yatra == '1') { echo '1'; } else { echo '0'; } ?>" <?php if ($dham_yatra == '1') { echo 'checked'; } else { echo ''; } ?>><span class="switch-state"></span> </label> </div> </div> <div class="row align-items-center"> <label class="col-sm-3 col-form-label form-label-title">Domestic</label> <div class="col-sm-9"> <label class="switch"> <input type="checkbox" name="domestic" value="<?php if ($domestic == '1') { echo '1'; } else { echo '0'; } ?>" <?php if ($domestic == '1') { echo 'checked'; } else { echo ''; } ?>><span class="switch-state"></span> </label> </div> </div> <div class="row align-items-center"> <label class="col-sm-3 col-form-label form-label-title">Weekend</label> <div class="col-sm-9"> <label class="switch"> <input type="checkbox" name="weekend" value="<?php if ($weekend == '1') { echo '1'; } else { echo '0'; } ?>" <?php if ($weekend == '1') { echo 'checked'; } else { echo ''; } ?>><span class="switch-state"></span> </label> </div> </div> <div class="mb-4 row align-items-center"> <label class="col-sm-3 col-form-label form-label-title">Select Category</label> <div class="col-sm-9"> <select class="js-example-basic-single w-100" name="category" required> <?php if ($category) { $sql1 = "SELECT * FROM `category` WHERE `status` = '1' AND `id` = '$category'"; $res1 = mysqli_query($con, $sql1); $row1 = mysqli_fetch_assoc($res1); echo '<option value="' . $category . '" selected>' . $row1['name'] . '</option>'; } else { echo '<option value="" selected>Choose Category</option>'; } $sql = "SELECT * FROM `category` WHERE `status` = '1'"; $res = mysqli_query($con, $sql); while ($row = mysqli_fetch_assoc($res)) { echo '<option value="' . $row['id'] . '">' . $row['name'] . '</option>'; } ?> </select> </div> </div> <?php if ($url != '') { ?> <div class="mb-4 row align-items-center"> <label class="form-label-title col-sm-3 mb-0">Package Url</label> <div class="col-sm-9"> <input class="form-control" type="text" name="url" value="<?php echo $url ?>" placeholder="Package Url" required> </div> </div> <?php } ?> <div class="mb-4 row align-items-center"> <label class="form-label-title col-sm-3 mb-0">Package Name</label> <div class="col-sm-9"> <input class="form-control" type="text" name="name" value="<?php echo $name ?>" placeholder="Package Name" required> </div> </div> <div class="mb-4 row align-items-center"> <label class="form-label-title col-sm-3 mb-0">Package Title</label> <div class="col-sm-9"> <input class="form-control" type="text" name="title" value="<?php echo $title ?>" placeholder="Package Title" required> </div> </div> <div class="mb-4 row align-items-center"> <label class="form-label-title col-sm-3 mb-0">Short Description</label> <div class="col-sm-9"> <input class="form-control" type="text" name="short_description" value="<?= $short_description ?>" placeholder="Short Description" required> </div> </div> <?php if (isset($_GET['id'])) { ?> <div class="mb-4 row align-items-center" id="image_box"> <label class="col-sm-3 col-form-label form-label-title">Images</label> <?php $all_image = json_decode($image); for ($i = 0; $i < count($all_image); $i++) { ?> <div class="col-sm-6" id="image_container_<?php echo $i; ?>"> <input class="form-control form-choose" name="image[]" type="file" id="formFile_<?php echo $i; ?>"> <img src="../media/package/<?php echo $all_image[$i] ?>" alt="" style="width: 100px"> </div> <div class="col-lg-3"> <button type="button" class="btn btn-sm btn-danger mt-2" onclick="remove_existing_image(<?php echo $i; ?>)"> <span id="payment-button-amount">Remove</span> </button> </div> <?php } ?> <div class="col-lg-3"> <button type="button" class="btn btn-sm btn-info mt-2" onclick="add_more_images()"> <span id="payment-button-amount">Add Image</span> </button> </div> </div> <?php } else { ?> <div class="mb-4 row align-items-center" id="image_box"> <label class="col-sm-3 col-form-label form-label-title">Images</label> <div class="col-sm-6"> <input class="form-control form-choose" name="image[]" type="file" id="formFile_1"> </div> <div class="col-lg-3"> <button type="button" class="btn btn-sm btn-info mt-2" onclick="add_more_images()"> <span id="payment-button-amount">Add Image</span> </button> </div> </div> <?php } ?> <div class="mb-4 row align-items-center"> <label class="form-label-title col-sm-3 mb-0">Image Alt Tag</label> <div class="col-sm-9"> <input class="form-control" type="text" name="image_alt_tag" value="<?php echo $image_alt_tag ?>" placeholder="Image Alt Tag" required> </div> </div> <div class="mb-4 row align-items-center"> <label class="form-label-title col-sm-3 mb-0">Days</label> <div class="col-sm-9"> <input class="form-control" name="days" value="<?php echo $days ?>" type="text" placeholder="Days" required> </div> </div> <div class="mb-4 row align-items-center"> <label class="form-label-title col-sm-3 mb-0">Price</label> <div class="col-sm-9"> <input class="form-control" name="price" value="<?php echo $price ?>" type="text" placeholder="Price" required> </div> </div> <div class="mb-4 row"> <label class="form-label-title col-sm-12 mb-0">Package Description</label> <div class="col-sm-12"> <textarea id="editor" name="description"><?php echo $description ?></textarea> </div> </div> <div class="mb-4 row align-items-center"> <label class="form-label-title col-sm-3 mb-0">Map</label> <div class="col-sm-9"> <input class="form-control" name="map" value="<?php echo $map ?>" type="text" placeholder="Map" required> </div> </div> </div> </div> <div class="card"> <div class="card-body"> <div class="card-header-2"> <h5>Search engine listing</h5> </div> <div class="seo-view"> <span class="link"><?= $canonical_tag ?></span> <h5><?= $meta_title ?></h5> <p><?= $meta_description ?></p> </div> <div class="mb-4 row align-items-center"> <label class="form-label-title col-sm-3 mb-0">Meta title</label> <div class="col-sm-9"> <input class="form-control" name="meta_title" value="<?= $meta_title ?>" type="text" placeholder="Meta title"> </div> </div> <div class="mb-4 row"> <label class="form-label-title col-sm-3 mb-0">Meta Description</label> <div class="col-sm-9"> <textarea class="form-control" name="meta_description" rows="3"><?= $meta_description ?></textarea> </div> </div> <div class="row"> <label class="form-label-title col-sm-3 mb-0">Keyword</label> <div class="col-sm-9"> <input class="form-control" type="text" name="keyword" value="<?= $keyword ?>" placeholder="Keyword"> </div> </div> <div class="row"> <label class="form-label-title col-sm-3 mb-0">Canonical Tag</label> <div class="col-sm-9"> <input class="form-control" type="text" name="canonical_tag" value="<?= $canonical_tag ?>" placeholder="Canonical Tag"> </div> </div> </div> </div> </div> <?php if (isset($_GET['id'])) { ?> <input type="hidden" name="id" value="<?php echo $id ?>"> <button class="btn btn-solid" name="update_package_submit" type="submit">Update</button> <?php } else { ?> <button class="btn btn-solid" name="submit" type="submit">Submit</button> <?php } ?> </div> </form> </div> </div> </div> <!-- New package Add End --> <!-- footer Start --> <?php include('include/footer_admin.php'); ?> <!-- footer En --> </div> <!-- Container-fluid End --> </div> <!-- Page Body End --> </div> <!-- page-wrapper End --> <script> var total_image = <?php echo isset($_GET['id']) ? count($all_image) : 1; ?>; function add_more_images() { total_image++; var html = '<div class="row" id="add_image_box_' + total_image + '" ><div class="col-lg-3"></div><div class="col-lg-6">' + '<input class="form-control form-choose" type="file" name="image[]" id="formFile_' + total_image + '"></div>' + '<div class="col-lg-3"><button type="button" ' + 'class="btn btn-sm btn-danger btn-info mt-2" onclick="remove_image(' + total_image + ')">' + '<span id="payment-button-amount">Remove</span></button>' + '</div></div>'; jQuery('#image_box').append(html); } function remove_image(id) { jQuery('#add_image_box_' + id).remove(); } function remove_existing_image(id) { jQuery('#image_container_' + id).remove(); } </script> <?php include('include/foot_admin.php'); ?> </body> </html>