Viewing file: features_update.php (4.68 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<? include 'index_IncludeAdmin.php'; $_SESSION['page'] = 'features.php';
if (isset($_GET[features_id])){ $_SESSION[features_id] = $_GET[features_id]; } $features_id = $_SESSION[features_id] ;
$features_SL = " SELECT * FROM features WHERE features_id = '$features_id'"; $features_QR = mysqli_query($con,$features_SL); $features = mysqli_fetch_array($features_QR);
if ($_POST['features_Update']) {
$features_name = trim($_POST['features_name']); $features_name= str_replace("'","'",$features_name); $features_name= str_replace("\"",""",$features_name);
$features_detail = trim($_POST['features_detail']); $features_detail= str_replace("'","'",$features_detail); $features_detail= str_replace("\"",""",$features_detail);
$features_Update = "UPDATE `features` SET `features_name` = '$features_name' ,`features_detail` = '$features_detail' WHERE `features_id` = '$features_id'"; $features_Reult = mysqli_query($con,$features_Update);
if (!$features_Reult) { echo"<script>alert('เกิดข้อผิดพลาด'); window.history.back(); </script>"; }
if($_FILES['features_photo']['name']!=''){ @unlink("../Files/features_photo/".$features['features_photo']); $Jpg = strrchr($_FILES["features_photo"]["name"],"."); $features_photo = rand().rand().$Jpg; $upload = move_uploaded_file($_FILES["features_photo"]["tmp_name"],"../Files/features_photo/".$features_photo); $features_photo_Update = "UPDATE `features` SET `features_photo` = '$features_photo' WHERE `features_id` = '$features_id'"; $features_photo_Reult = mysqli_query($con,$features_photo_Update); }
if ($features_Reult) { echo"<script> window.location='features_one.php?UPDATE'; </script>"; }
}
?>
<!DOCTYPE html> <html> <head> <script src="//cdn.ckeditor.com/4.11.4/basic/ckeditor.js"></script> <? include 'index_Head.php'; ?> </head> <body> <? include 'index_Navbar.php'; ?> <div class="container-fluid"> <div class="row"> <div class="col-md-2" id="main-left"> <div class="row"> <div class="col-md-12"> <? include 'index_AdminMenu.php'; ?> </div> </div> </div> <div class="col-md-10"> <div class="row"> <div class="col-md-12"> <h3> แก้ไข คุณสมบัติ : <span class="text-primary bold"> <?php echo $features[features_name]; ?> </span> </h3> <hr> </div> </div> <div class="row"> <div class="col-md-12 br-margin2"> <a onclick="goBack()" class="btn btn-primary"><span class="glyphicon glyphicon-step-backward"></span> กลับ </a> </div> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> กรอกรายละเอียด "คุณสมบัติ" ที่ต้องการแก้ไข </div> <div class="panel-body"> <form class="form-horizontal" method="post" enctype="multipart/form-data"> <div class="form-group"> <label class="control-label col-md-3" >ชื่อคุณสมบัติ <span class="text-red"> * </span> </label> <div class="col-md-6"> <input type="text" class="form-control" value="<? echo $features[features_name]; ?>" name="features_name" placeholder="ชื่อคุณสมบัติ" required> </div> </div> <div class="form-group"> <label class="control-label col-md-3" > รายละเอียด </label> <div class="col-md-6"> <textarea class="ckeditor" name="features_detail"><? echo $features[features_detail]; ?></textarea> </div> </div> <div class="form-group"> <label class="control-label col-md-3" >รูปคุณสมบัติ </label> <div class="col-md-6"> <input type="file" class="form-control br2" name="features_photo" placeholder="" > </div> <label class="control-label col-md-3 text-left" > รูปใหม่ที่ต้องการเปลี่ยน </label> </div> <div class="form-group"> <div class="col-md-offset-3 col-md-5"> <input type="hidden" name="features_Update" value="x"> <button onclick="return confirm('ยืนยันการแก้ไข ? ')" type="submit" class="btn btn-info"> <span class="glyphicon glyphicon-floppy-disk"></span> บันทึกการแก้ไข </button> </div> </div> </form> </div> <div class="panel-footer"> </div> </div> </div> <!-- 12 --> </div> <!-- row --> </div> <!-- 10 --> </div> <!-- row --> </div> <!-- container --> </body> </html>
|