| Server IP : 61.19.30.66 / Your IP : 216.73.216.59 Web Server : Apache/2.2.22 (Ubuntu) System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 User : www-data ( 33) PHP Version : 5.3.10-1ubuntu3.48 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/gpa/students/ |
Upload File : |
<?php
include_once('../config/configuser.inc.php');
$cllass =$objResult["cllass"];
include_once('head.php');
include_once('function.php');
$objCon = connectDB();
$c_id = (int) $_GET['c_id'];
$strSQL = "SELECT * FROM klw WHERE Username = $c_id";
$objQuery = mysqli_query($objCon, $strSQL);
$objResult = mysqli_fetch_array($objQuery, MYSQLI_ASSOC);
if ($objResult == null) {
echo '<script>alert("ไม่พบข้อมูล!!");window.location="index.php";</script>';
}
?>
<!doctype html>
<html lang="th" class="h-100">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>แก้ไขข้อมูล</title>
<!-- Bootstrap core CSS -->
<link href="./css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="./css/style.css" rel="stylesheet">
</head>
<body class="d-flex flex-column h-100">
<main class="flex-shrink-0">
<div class="container">
<h1 class="mt-5">ภาพตัวอย่าง พื้นหลังสีขาวเท่านั้น</h1>
<td><img src="pictest.jpg" class="img-thumbnail" id="c_image_preview" /></td>
<div class="mt-4">
<a href="user_page.php" class="btn btn-warning">หน้าหลัก</a>
</div>
<!-- ฟอร์มเพิ่มข้อมูล -->
<form action="action_update.php" id="form_update" method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-md-9">
<div class="row mt-4">
<!-- แถวที่ 1 -->
<!-- แถวที่ 2 -->
<!-- แถวที่ 3 -->
<div class="col-md-12 mt-3">
<input type="hidden" name="c_id" value="<?php echo $objResult['Username']; ?>">
<input type="hidden" name="class" value="<?php echo $objResult['cllass']; ?>">
</div>
<!-- ปุ่มบันทึก -->
<div class="col-md-12 mt-3">
<button type="submit" class="btn btn-primary btn-lg">บันทึกการแก้ไข</button>
<button type="reset" class="btn btn-light btn-lg">ล้างค่า</button>
</div>
</div>
</div>
<duv class="col-md-3">
<!-- ข้อมูลรูปภาพ -->
<div class="row mt-4">
<div class="col-md-12 mt-3">
<label for="c_image" class="form-label">รูปภาพ</label>
<input class="form-control" id="c_image" name="c_image" type="file" onchange="loadFile(event)">
</div>
<div class="col-md-12 mt-3">
<?php if ($objResult['c_image'] != '') { ?>
<img src="./images/<?php echo $objResult['cllass']; ?>/<?php echo $objResult['c_image']; ?>" class="img-thumbnail" id="c_image_preview" />
<?php } else { ?>
<img src="./images/noimg.png" class="img-thumbnail" id="c_image_preview" />
<?php } ?>
</div>
</div>
</duv>
</form>
</div>
</main>
<footer class="footer mt-auto py-3 bg-light">
<div class="container">
<span class="text-muted">© 2021</span>
</div>
</footer>
<script src="./js/bootstrap.bundle.min.js"></script>
<script src="./js/script.js"></script>
<script>
var loadFile = function(event) {
var reader = new FileReader();
reader.onload = function() {
var output = document.getElementById('c_image_preview');
output.src = reader.result;
};
reader.readAsDataURL(event.target.files[0]);
}
</script>
</body>
</html>