D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
realadss
/
kavyaeventz.in
/
backup
/
Filename :
blog-edit.php
back
Copy
<?php include('include/header.php'); $blog_id=$_GET['eid']; $sql=mysqli_query($conn,"select * from blog where blog_id='$blog_id'"); $fetch=mysqli_fetch_array($sql); if(isset($_POST['update'])) { $blog_id = $_POST['blog_id']; $blog_title =$_POST['blog_title']; $blogger_name =$_POST['blogger_name']; $blog_desc =$_POST['blog_desc']; $date = date('Y/m/d'); $filename = $_FILES['image']['name']; $tmpname = $_FILES['image']['tmp_name']; $add = "images/products/".$filename; move_uploaded_file($tmpname,$add); if ((!($_FILES['image']['name']))) { $updateData=mysqli_query($conn,"UPDATE `blog` SET `blog_id`='$blog_id',`blog_title`='$blog_title',`blog_desc`='$blog_desc',`blogger_name`='$blogger_name',`date`='$date' where blog_id='$blog_id'"); } else { $updateData=mysqli_query($conn,"UPDATE `blog` SET `blog_id`='$blog_id',`blog_title`='$blog_title',`blog_desc`='$blog_desc',`image`='$filename',`blogger_name`='$blogger_name',`date`='$date' where blog_id='$blog_id'"); } if($updateData) { echo "<script>alert('Data Updated');window.location.href='blog.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 Blog</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="blog_id" value="<?php echo $fetch['blog_id'];?>" readonly> </div> <div class="form-group"> <label class="form-label">Blogger Name</label> <input type="text" class="form-control" value="<?php echo $fetch['blogger_name'];?>" name="blogger_name" required> </div> <div class="form-group"> <label class="form-label">Blog Title</label> <input type="text" class="form-control" value="<?php echo $fetch['blog_title'];?>" name="blog_title" required maxlength="180"> </div> <div class="form-group"> <label class="form-label">Description</label> <textarea name="blog_desc" id="editor"><?php echo $fetch['blog_desc'];?></textarea> </div> <div class="form-group"> <label class="form-label">Image</label> <input type="file" class="form-control" accept="image/png, image/jpeg, image/jpg" name="image" onchange="ShowImage(event)" > <img src="images/products/<?php echo $fetch['image']; ?>" id="image" style="width:150px; height:150px;"> </div> <div class="box-footer"> <button type="submit" class="btn btn-success" name="update">Update</button> </div> </form> <div class="error"><?php if(!empty($msg)){ echo $msg; } ?></div> </div> <!-- /.box-body --> </div> </div> <!-- /.box-body --> </div> </section> <!-- /.content --> </div> </div> <script src="//cdn.ckeditor.com/4.22.1/standard/ckeditor.js"></script> <script> CKEDITOR.replace( 'editor'); </script> <script> CKEDITOR.replace( 'editor2'); </script> <?php include('include/footer.php');?>