D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
realadss
/
.trash
/
admin
/
Filename :
banner-edit.php
back
Copy
<?php include('include/header.php'); $id=$_GET['eid']; $sql=mysqli_query($conn,"select * from banner where id='$id'"); $fetch=mysqli_fetch_array($sql); if(isset($_POST['update'])) { $bannertitle =$_POST['title']; $banneralt =$_POST['alt']; $date = date('Y/m/d'); $uniqe_image1 = $fetch['image']; $image01 = $_FILES['image']['name']; if(!empty($image01)){ $unique = uniqid()." ".$image01; $image1 = "images/product/".$unique; $stmp_name1 = $_FILES['image']['tmp_name']; move_uploaded_file($stmp_name1, $image1); }else{ $image1=$uniqe_image1; } $updateData=mysqli_query($conn,"update banner set id='$id',image='$image1',image_title='$bannertitle',image_alt='$banneralt',createdate ='$date' where id='$id'"); if($updateData) { echo "<script>alert('Banner Image Updated');window.location.href='banner.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 Banner</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">Banner Image</label> <input type="hidden" name="image" value="<?php echo $fetch['image'];?>"> <input type="file" class="form-control" accept="image/png, image/jpeg, image/jpg" name="image" onchange="ShowImage(event)"> <img src='<?php echo $fetch['image'];?>' width="200" id="image" /> </div> <div class="form-group"> <label class="form-label">Image Title</label> <input type="text" class="form-control" name="title" value="<?php echo $fetch['image_title'];?>" required> </div> <div class="form-group"> <label class="form-label">Image alt</label> <input type="text" class="form-control" name="alt" value="<?php echo $fetch['image_alt'];?>" required> </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');?>