|
Server IP : 103.212.121.57 / Your IP : 216.73.216.123 Web Server : LiteSpeed System : Linux valor.herosite.pro 4.18.0-553.80.1.lve.el8.x86_64 #1 SMP Wed Oct 22 19:29:36 UTC 2025 x86_64 User : araipddz ( 1784) PHP Version : 8.2.30 Disable Function : show_source, system, shell_exec, passthru, popen, exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/araipddz/cytelelevators.in/admin/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include("header.php");
include("aside.php");
$id = $_GET['id'];
$select = "SELECT * FROM `product` WHERE `id` = '$id'";
$query = mysqli_query($connect, $select);
$row = mysqli_fetch_assoc($query);
$update_img = $row['pro_image'];
if (isset($_POST['submit'])) {
// $heading= $_POST['heading'];
$name= $_POST['name'];
$desc= $_POST['desc'];
$image = $_FILES['image']['name'];
$img_path = "./product/".$image;
if ($image == "") {
$update = "UPDATE `product` SET `pro_name`='$name',`pro_description`='$desc' WHERE `id`='$id'";
$sql = mysqli_query($connect, $update);
if ($sql) {
echo "Data updated";
} else {
echo "Data did not update: " . mysqli_error($connect);
}
} else {
$update = "UPDATE `product` SET `pro_name`='$name',`pro_description`='$desc',`pro_image`='$image' WHERE `id`='$id'";
$sql = mysqli_query($connect, $update);
if ($sql) {
unlink("./Product/" . $update_img);
move_uploaded_file($_FILES['image']['tmp_name'], $img_path);
header('location: categoriesdatatable.php');
} else {
echo "Data did not update: " . mysqli_error($connect);
}
}
}
?>
<div class="container w-100 h-100 mt-5">
<button> <a class="btn btn-outline-primary" href="categoriesdatatable.php">View Data</a></button>
<h3 class="text-center"> Update Product</h3>
<div class="row">
<div class="col-md-9 mt-5">
<form method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="exampleInputEmail1">product name:</label>
<textarea class="form-control" name="name" ><?php echo $row['pro_name']?></textarea>
</div>
<div class="form-group">
<label for="exampleInputEmail1">product Description:</label>
<textarea name="desc" ><?php echo $row['pro_description']?></textarea>
</div>
<div class="form-group">
<label for="exampleInputEmail1">product Image:</label>
<input type="file" class="form-control" name="image" id="exampleInputEmail1"
aria-describedby="emailHelp" placeholder="pro Image">
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="exampleCheck1">
<label class="form-check-label" for="exampleCheck1">Check me out</label>
</div>
<button type="submit" class="btn btn-primary" name="submit">Submit</button>
</form>
</div>
</div>
</div>
<?php include("footer.php"); ?>