-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_student.php
46 lines (41 loc) · 2.05 KB
/
update_student.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<html lang="en">
<head>
<title>Updating Infomation Student</title>
<base href="/">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="img/x-icon" href="icon.ico">
<link href="https://fonts.googleapis.com/css?family=Kodchasan&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<?php
$serverName = "localhost";
$userName = "root";
$userPassword = "";
$dbName = "school";
$stdid = $_POST['studentID'];
$ntitle = $_POST['ntitle'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$pname = $_POST['pname'];
$pphone = $_POST['pphone'];
$disease = $_POST['disease'];
$status = $_POST['groupOfRadios'];
$objCon = new mysqli($serverName,$userName,$userPassword,$dbName);
mysqli_set_charset($objCon, "utf8");
$strSQL = "UPDATE student SET ntitle='$ntitle', stdfname='$firstname', stdlname='$lastname', address='$address', phone='$phone', pname='$pname', pphone='$pphone', disease='$disease', status='$status' WHERE studentID='$stdid'";
if($objCon->query($strSQL)) {
echo '<script type="text/javascript">
alert("Update Infomation Student Completed!")
window.location.replace("http://localhost/project/student.php")
</script>';
$objCon->close();
} else {
echo "ERROR: Could not able to execute $strSQL. " . mysqli_error($objCon);
}
?>
</body>
</html>