<html>
<head></head>
<body>
ระบบบันทึกข้อมูล
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "student";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$no = $_GET['no'];
$name = $_GET['name'];
$bd = $_GET['bd'];
$sql = "INSERT INTO student (no,name,bd) VALUES (?,?,?)";
$stmt = $conn->prepare($sql);
$stmt->bind_param("dss",$no,$name,$bd);
$stmt->execute();
}
?>
<form action="index.php" method="get">
เลขที่:
<input type="text" id="no" name="no" >
ชื่อ-นามสกุล:
<input type="text" id="name" name="name" >
วันเดือนปีเกิด:
<input type="text" id="bd" name="bd" >
<button type="submit">บันทึกข้อมูล</button>
</form>
</body>
</html>