/
home
/
annai
/
public_html
/
YyteqvCso$vXMmYyy
/
File Upload :
llllll
Current File: /home/annai/public_html/YyteqvCso$vXMmYyy/catogoryedit.php
<?php include('session.php')?> <?php include('header.php')?> <link href="vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet"> <style> img.banner { width: 145px; height: 86px; } </style> <script> function show_confirm() { return confirm("Are You Sure"); } </script> <?php include('connect.php'); $id=$_GET['id']; $sql1=mysqli_query($conn,"select * from product_category where id='$id'"); $row1=mysqli_fetch_array($sql1); if(isset($_POST['submit'])) { $category=$_POST['category']; $description=$_POST['description']; move_uploaded_file($_FILES['image']['tmp_name'],"img/".$_FILES['image']['name']); $image="img/".$_FILES['image']['name']; if($_FILES['image']['tmp_name'] != ""){ $sql=mysqli_query($conn,"update product_category set category='$category', description='$description', image='$image' where id='$id'"); } else{ $sql=mysqli_query($conn,"update product_category set category='$category', description='$description' where id='$id'"); } if($sql) { echo "<script>alert('Data submitted successfully')</script>"; echo "<script> window.location.assign('product_category.php')</script>"; } else{ echo "<script>alert('Failed to submit data')</script>"; } } ?> <body id="page-top"> <!-- Page Wrapper --> <div id="wrapper"> <!-- Sidebar --> <?php include('sidebar.php')?> <!-- End of Sidebar --> <!-- Content Wrapper --> <div id="content-wrapper" class="d-flex flex-column"> <!-- Main Content --> <div id="content"> <!-- Topbar --> <?php include('topbar.php')?> <!-- End of Topbar --> <!-- Begin Page Content --> <div class="container-fluid"> <!-- Page Heading --> <div class="d-sm-flex align-items-center justify-content-between mb-4"> <h1 class="h3 mb-0 text-gray-800">Product category</h1> <a href="product_category.php"><h1 class="h3 mb-0 text-gray-800">Go Back</h1></a> </div> <div class="card shadow mb-4"> <div class="col-lg-7"> <div class="p-5"> <div class="text-center"> </div> <form class="user" action="" method="post" enctype="multipart/form-data"> <div class="form-group row"> <div class="col-sm-12 mb-3 mb-sm-0"> <label for="exampleInputFile">Product category</label> <input type="text" class="form-control" id="exampleFirstName" value="<?php echo $row1['category'];?>" placeholder="Farmer Name" name="category"> </div> <div class="col-sm-12 mb-3 mb-sm-0"> <label for="exampleInputFile">Image</label> <img class="banner" src="<?php echo $row1['image'];?>"> <input type="file" class="form-control" id="exampleFirstName" name="image"> </div> <div class="col-sm-12 mb-3 mb-sm-0"> <label for="exampleInputFile">Product description</label> <input type="text" class="form-control" id="exampleFirstName" value="<?php echo $row1['description'];?>" placeholder="Product description" name="description"> </div> </div> <input type="submit" class="btn btn-primary btn-user btn-block" name="submit" value="UPLOAD" style="background-color:#3ba66b ; border:1px solid #3ba66b;"> </div> </div> </div> <!-- DataTales Example --> <!-- DataTales Example --> <div class="card shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 font-weight-bold text-primary">DataTable</h6> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0"> <thead> <tr> <th>S.No</th> <th>Product Category</th> <th>Image </th> <th>description </th> <th>Delete</th> </tr> </thead> <tbody> <?php $x = 1; $sql=mysqli_query($conn,"SELECT * FROM product_category"); while($row=mysqli_fetch_array($sql)) { ?> <tr> <td><?php echo $x; ?></td> <td><?php echo $row['category']; ?></td> <td><img class="banner" src="<?php echo $row['image']; ?>"></td> <td><?php echo $row['description']; ?></td> <td> <a title="Delete" href="product_category_delete.php?id=<?php echo $row['id']; ?>" class="" onclick='return show_confirm();'><img class="" src="img/del.png"></a></td> </tr> <?php $x++; } echo '<script type="text/javascript"> drawChart(); </script>'; ?> </tbody> </table> </div> </div> </div> </div> <!-- /.container-fluid --> </div> <!-- End of Main Content --> <?php include('footer.php')?>
Copyright ©2k19 -
Hexid
|
Tex7ure