Viewing File: /home/webrbaew/kitothecandytea.com/admin/edit_product.php
<?php session_start(); ?>
<?php
include "database.php";
include "includes/operations.php";
if(!isset($_SESSION['admin_id'])){
echo '<script> window.location.href = "login.php"; </script>';
header("location:login.php"); exit();
}
$product_id = 0;
if(isset($_GET['pid'])){
$product_id = intval($_GET['pid']);
}
$result = mysqli_query($con, "SELECT * FROM product WHERE product_id=$product_id");
$row = mysqli_fetch_array($result);
$product_title = $row['product_title'];
$product_price = $row['product_price'];
$product_shipping_cost = $row['product_shipping_cost'];
$product_description = $row['product_description'];
$status = $row['status'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include "includes/headerlinks.php";?>
<style>
.form-group {
margin-bottom:15px !important;
}
</style>
</head>
<body class="fix-header card-no-border">
<!-- ============================================================== -->
<!-- Preloader - style you can find in spinners.css -->
<!-- ============================================================== -->
<?php include "includes/loader.php";?>
<!-- ============================================================== -->
<!-- Main wrapper - style you can find in pages.scss -->
<!-- ============================================================== -->
<div id="main-wrapper">
<!-- ============================================================== -->
<!-- Topbar header - style you can find in pages.scss -->
<!-- ============================================================== -->
<?php include "includes/header.php";?>
<!-- ============================================================== -->
<!-- End Topbar header -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Left Sidebar - style you can find in sidebar.scss -->
<!-- ============================================================== -->
<?php include "includes/sidebar.php";?>
<!-- ============================================================== -->
<!-- End Left Sidebar - style you can find in sidebar.scss -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Page wrapper -->
<!-- ============================================================== -->
<div class="page-wrapper">
<!-- ============================================================== -->
<!-- Bread crumb and right sidebar toggle -->
<!-- ============================================================== -->
<div class="row page-titles">
<div class="col-md-5 align-self-center">
<h3 class="text-themecolor">Edit Product</h3>
</div>
<div>
<button style="display:none" class="right-side-toggle waves-effect waves-light btn-inverse btn btn-circle btn-sm pull-right m-l-10"><i class="ti-settings text-white"></i></button>
</div>
</div>
<!-- ============================================================== -->
<!-- End Bread crumb and right sidebar toggle -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Container fluid -->
<!-- ============================================================== -->
<div class="container-fluid">
<!-- ============================================================== -->
<!-- Start Page Content -->
<!-- ============================================================== -->
<!-- Row -->
<div class="row">
<!-- Column -->
<!-- Column -->
<!-- Column -->
<div class="col-lg-12 col-xlg-9 col-md-7">
<div class="card">
<div class="tab-content">
<!--second tab-->
<div class="tab-pane active" id="settings" role="tabpanel">
<div class="card-body">
<form method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="exampleInputEmail1"><b>Title</b></label>
<input type="hidden" value="<?php echo $product_id;?>" name="product_id">
<input type="text" class="form-control" name="product_title" value="<?php echo $product_title;?>" id="exampleInputEmail3" placeholder="Enter Title.." required>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputEmail1"><b>Price</b></label>
<input type="number" class="form-control" name="product_price" value="<?php echo $product_price;?>" id="exampleInputEmail3" placeholder="Enter Price.." required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputEmail1"><b>Status</b></label>
<div class="demo-radio-button">
<input name="status" type="radio" id="radio_30" class="with-gap radio-col-light-green" value="1" <?php if($status==1) echo 'checked'?>>
<label for="radio_30">Active</label>
<input name="status" type="radio" id="radio_31" value="0" <?php if($status==0) echo 'checked'?> class="with-gap radio-col-pink">
<label for="radio_31">Draft</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="exampleInputEmail1"><b>Description</b></label>
<textarea rows="5" class="form-control" name="product_description" id="exampleInputEmail3" placeholder="Enter Description.." required><?php echo $product_description?></textarea>
</div>
<div class="row mb-4">
<div class="col-md-12">
<img src="../images/product_images/<?php echo $row['product_image']?>" style="width:10%;margin-bottom:15px" class="img-responsive" width="80px" onerror="this.onerror=null;this.src='assets/images/null.png'">
<br><label for="exampleInputEmail1"><b>Picture</b></label>
<div class="custom-file">
<input type="file" name="product_image" class="custom-file-input" id="customFile" accept="image/*">
<label class="custom-file-label form-control" for="customFile">Choose file</label>
</div>
</div>
</div>
<div class="form-group">
<div class="">
<button type="submit" class="waves-effect btn btn-success" name="update_product">Save</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- Column -->
</div>
<!-- ============================================================== -->
<!-- End Right sidebar -->
<!-- ============================================================== -->
</div>
<!-- ============================================================== -->
<!-- End Container fluid -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- footer -->
<!-- ============================================================== -->
<?php include "includes/footer.php";?>
<?php include "includes/theme.php";?>
<!-- ============================================================== -->
<!-- End footer -->
<!-- ============================================================== -->
</div>
<!-- ============================================================== -->
<!-- End Page wrapper -->
<!-- ============================================================== -->
</div>
<!-- ============================================================== -->
<!-- End Wrapper -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- All Jquery -->
<!-- ============================================================== -->
<script src="assets/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap tether Core JavaScript -->
<script src="assets/plugins/bootstrap/js/popper.min.js"></script>
<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<!-- slimscrollbar scrollbar JavaScript -->
<script src="js/jquery.slimscroll.js"></script>
<!--Wave Effects -->
<script src="js/waves.js"></script>
<!--Menu sidebar -->
<script src="js/sidebarmenu.js"></script>
<!--stickey kit -->
<script src="assets/plugins/sticky-kit-master/dist/sticky-kit.min.js"></script>
<script src="assets/plugins/sparkline/jquery.sparkline.min.js"></script>
<!--Custom JavaScript -->
<script src="js/custom.min.js"></script>
<!-- ============================================================== -->
<!-- Style switcher -->
<!-- ============================================================== -->
<script src="assets/plugins/styleswitcher/jQuery.style.switcher.js"></script>
<script src="js/multiselect-dropdown.js" ></script>
</body>
<script>
// Add the following code if you want the name of the file appear on select
$(".custom-file-input").on("change", function() {
var fileName = $(this).val().split("\\").pop();
$(this).siblings(".custom-file-label").addClass("selected").html(fileName);
});
</script>
</html>
Back to Directory
File Manager