-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudent-edit.php
120 lines (106 loc) · 5.16 KB
/
student-edit.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
session_start();
require 'dbcon.php';
?>
<?php
if($_SESSION['email'])
{
}
else{
header("Location: tlogin.html");
}?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<title>Student Edit</title>
</head>
<body>
<div class="container mt-5">
<?php include('message.php'); ?>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h4>Student Edit
<a href="student.php" class="btn btn-danger float-end">BACK</a>
</h4>
</div>
<div class="card-body">
<?php
if(isset($_GET['id']))
{
$student_id = mysqli_real_escape_string($con, $_GET['id']);
$query = "SELECT * FROM student WHERE id='$student_id' ";
$query_run = mysqli_query($con, $query);
if(mysqli_num_rows($query_run) > 0)
{
$student = mysqli_fetch_array($query_run);
?>
<form action="code.php" method="POST">
<input type="hidden" name="student_id" value="<?= $student['id']; ?>">
<div class="mb-3">
<label>First Name</label>
<input type="text" name="FirstName" value="<?=$student['FirstName'];?>" class="form-control">
</div>
<div class="mb-3">
<label>Last Name</label>
<input type="text" name="LastName" value="<?=$student['LastName'];?>" class="form-control">
</div>
<div class="mb-3">
<label>DateOfBirth</label>
<input type="date" name="DateOfBirth" value="<?=$student['DateOfBirth'];?>" class="form-control">
</div>
<div class="mb-3">
<label>Gender</label>
<input type="text" name="Gender" value="<?=$student['Gender'];?>" class="form-control">
</div>
<div class="mb-3">
<label>Phone</label>
<input type="tel" name="Phone" value="<?=$student['Phone'];?>" class="form-control" pattern="[6-9]{1}[0-9]{9}" title=" must number starts with either 6 7 8 9 and rest of the values is number and it’s up to nine-digits[0-9]" required >
</div>
<div class="mb-3">
<label>Student Email</label>
<input type="text" name="Email" value="<?=$student['Email'];?>" class="form-control" pattern="[^@\s]+@[^@\s]+\.[^@\s]+" title="Invalid email address" >
</div>
<div class="mb-3">
<label>Password</label>
<input id="password" type="password" name="Password" value="<?=$student['Password'];?>" class="form-control" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters" required >
<input type="checkbox" onclick="myFunction()"> Show Password
</div>
<div class="mb-3">
<button type="submit" name="update_student" class="btn btn-primary">
Update Student
</button>
</div>
</form>
<?php
}
else
{
echo "<h4>No Such Id Found</h4>";
}
}
?>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
function myFunction() {
var x = document.getElementById("password");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "password";
}
}
</script>
</body>
</html>