Viewing file: features_add.php (3.99 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
include 'index_IncludeAdmin.php'; $_SESSION['page'] = 'features.php';
if ($_POST['features_Add']) {
$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_Add = "INSERT INTO `features` (`features_name`,`features_detail`,`features_photo`) VALUES ('$features_name','$features_detail','$features_photo')"; $features_Reult = mysqli_query($con,$features_Add);
$_SESSION[features_id] = mysqli_insert_id($con); if ($features_Reult) { if($_FILES['features_photo']['name']!=''){ $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 = '$_SESSION[features_id]'"; $features_photo_Reult = mysqli_query($con,$features_photo_Update); } echo"<script> window.location='features.php?INSERT'; </script>"; } else { echo"<script>alert('เกิดข้อผิดพลาด features_Reult'); window.history.back(); </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> เพิ่ม คุณสมบัติ </h3> <hr> </div> </div>
<div class="row">
<div class="col-md-12 br-margin2"> <a href="features.php" class="btn btn-primary"><span class="glyphicon glyphicon-step-backward"></span> กลับ </a> </div>
<div class="col-md-12"> <form class="form-horizontal" method="post" encType="multipart/form-data">
<div class="panel panel-default"> <div class="panel-heading"> กรอกรายละเอียด "คุณสมบัติ" ที่ต้องการเพิ่ม </div> <div class="panel-body"> <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" 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"></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" name="features_photo" > </div> </div> <div class="form-group"> <label class="control-label col-md-3" ></label> <div class="col-md-6"> <button Type="submit" class="btn btn-success"> <span class="glyphicon glyphicon-plus-sign"></span> ยืนยันการเพิ่ม </button> <input Type="hidden" name="features_Add" value="x"> </div> </div> </div> </div>
</form> </div>
<!-- 12 --> </div> <!-- row --> </div> <!-- 10 --> </div> <!-- row --> </div> <!-- container --> </body> </html>
|