D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
vhosts
/
sarainternational.ae
/
httpdocs
/
admin
/
Filename :
cat-edit.php
back
Copy
<?php include('include/header.php'); $id=$_GET['eid']; $catData=mysqli_query($conn,"select * from category where id='$id'"); $fetch=mysqli_fetch_array($catData); if(isset($_POST['update'])) { $id = $_POST['id']; $addcategory = $_POST['addcategory']; $date = date('Y/m/d'); $filename = $_FILES['image']['name']; $tmpname = $_FILES['image']['tmp_name']; $unique = uniqid()." ".$filename; $store = "images/products/".$unique; move_uploaded_file($tmpname,$store); $text = strtolower($addcategory); if ((!($_FILES['image']['name']))) { $updateData=mysqli_query($conn,"update category set id='$id',categoryName='$text',createDate='$date' where id='$id'"); } else { $updateData=mysqli_query($conn,"update category set id='$id',categoryName='$text', image='$store',createDate='$date' where id='$id'"); } if($updateData) { echo "<script>alert('Data Updated');window.location.href='category.php';</script>"; } else { echo mysqli_error($conn); } } ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <div class="container-full"> <!-- Main content --> <section class="content"> <div class="box"> <div class="box-header with-border"> <h4 class="box-title">Edit Category</h4> </div> <!-- /.box-header --> <div class="box-body"> <form role="form" method="POST" enctype="multipart/form-data"> <!-- text input --> <div class="form-group"> <label class="form-label">Id</label> <input type="text" class="form-control" name="id" value="<?php echo $fetch['id'];?>" readonly> </div> <div class="form-group"> <label class="form-label">Category</label> <input type="text" class="form-control" name="addcategory" value="<?php echo $fetch['categoryName'];?>" required> </div> <div class="form-group"> <label class="form-label">Image</label> <input type="file" class="form-control" name="image" value="<?php echo $fetch['image']; ?>" onchange="ShowImage(event)"/> <img src='<?php echo $fetch['image'];?>' value="<?php echo $fetch['image'];?>" width="200" id="image" /> </div> <div class="box-footer"> <button type="submit" class="btn btn-success" name="update">Update</button> </div> </form> </div> <!-- /.box-body --> </div> </div> <!-- /.box-body --> </div> </section> <!-- /.content --> </div> </div> <?php include('include/footer.php');?>