?
Path : /home/u949514618/domains/karmaasrconsultants.com/public_html/admin/ |
Current File : /home/u949514618/domains/karmaasrconsultants.com/public_html/admin/editpost.php |
<div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> <i class="fa fa-user"></i> Edit Press <small> Add/Edit Press</small> </h1> <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li> <li class="active">Edit Press Page</li> </ol> </section> <!-- Main content --> <section class="content"> <!-- Small boxes (Stat box) --> <div class="row"> <div class="col-xs-12"> <?php if(isset($_POST['submit'])){ $title = mysqli_real_escape_string($con,$_POST['pagetitle']); $image = $_FILES['image']['name']; $image_tmp = $_FILES['image']['tmp_name']; $brochure = $_FILES['brochure']['name']; $brochure_tmp = $_FILES['brochure']['tmp_name']; if(empty($image)){ $image = $e_page_image; } if(empty($brochure)){ $brochure = $e_page_pdf; } if(empty($title)){ $error = "All (*) fields are required"; } else{ $update_query = "update `posts` SET `title` = '$title', `image` = '$image', `pdf` = '$brochure' where `id` = $edit_id"; if(mysqli_query($con, $update_query)){ $msg = "Page has been updated"; header("refresh:0; url=edit-post.php?edit=$edit_id"); if(!empty($image)){ move_uploaded_file($image_tmp, "..post/$image"); } if(!empty($brochure)){ move_uploaded_file($brochure_tmp, "../post/brochure/$brochure"); } } else{ $error = "Page has not been updated"; } } } ?> <div class="col-md-8"> <div class="box box-info"> <div class="box-header with-border"> <h3 class="box-title">Add/Edit Press Details</h3> </div> <!-- /.box-header --> <!-- form start --> <form class="form-horizontal" method="post" enctype="multipart/form-data"> <div class="box-body"> <div class="form-group"> <label for="pagetitle" class="col-sm-2 control-label">Title*</label> <?php if(isset($error)){ echo "<span class='pull-right' style='color:red;'>$error</span>"; } else{ echo "<span class='pull-right' style='color:green;'>All Set Good</span>"; } ?> <div class="col-sm-10"> <input name="pagetitle" type="text" class="form-control" value="<?php echo $e_page_title; ?>" id="pagetitle" placeholder="Page Title"> </div> </div> <div class="form-group"> <label for="uploadimage" class="col-sm-2 control-label">Project Image</label> <div class="col-sm-10"> <input name="image" type="file" class="form-control" id="uploadimage"> </div> </div> <div class="form-group"> <label for="uploadpdf" class="col-sm-2 control-label">Project Pdf</label> <div class="col-sm-10"> <input name="brochure" type="file" class="form-control" id="uploadpdf"> </div> </div> </div> <!-- /.box-body --> <div class="box-footer"> <input type="submit" class="btn btn-info pull-right" value="Update Page" name="submit"> </div> <!-- /.box-footer --> </form> </div> </div> <div class="col-md-4"> <?php echo "<img src='../post/$e_page_image' width='100%'>"; ?> </div> <!-- /.box --> </div> </div> <!-- /.row --> <!-- Main row --> <!-- /.row (main row) --> </section> <!-- /.content --> </div>