forked from sushil11-art/Exam-Hall-Seating-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddStudent.php
127 lines (115 loc) · 3.12 KB
/
addStudent.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
121
122
123
124
125
126
127
<!DOCTYPE html>
<html>
<head>
<title>Add Student Data</title>
<style type="text/css">
.hr{
margin-top: 10px;
margin-right: 20px;
height: 3px;
background:royalblue;
}
.border{
margin-left: 100px;
width: 600px;
border: 1px dashed purple;
border-radius: 10px ;
}
.space{
margin: 10px;
}
</style>
</head>
<body>
<?php include "adminSlide.php"; ?>
<div style="margin-left: 220px; margin-top: 60px; margin-bottom: 30px;">
<!-- -----------------------------top--------------------------------------- -->
<div class="container">
<p><b><u><h3>Add Student Data</u></b></p></h3>
</div>
<div class="container">
<hr class="hr">
</div>
<!-- -----------------------------form------------------------------------------ -->
<div class="border">
<form style="margin-left: 100px;" action="addStudent.php" method="POST">
<div class="space">
<label>
Student Name : <input type="text" name="name" required >
</label>
</div>
<div class="space">
<label>
Roll no : <input type="number" name="roll" required>
</label>
</div>
<div class="space">
<label>
Exam Roll : <input type="number" name="eroll" required>
</label>
</div>
<div class="space">
<label>Gender</label>
<label class="space"> <input
type="radio" name="gender" value="m" checked="checked" > Male
</label>
<label class="space"> <input
type="radio" name="gender" value="f"> Female
</label>
</div>
<div class="space">
<label>
Semester : <input type="number" name="sem" required>
</label>
</div>
<div class="space">
<label>
Department : <select name="dep" required="required">
<option value=" IT">IT-Information Technology</option>
<option value="CE">CE-Computer Engineering</option>
<option value="SE">SE-Software Engineering</option>
</select>
</label>
</div>
<div class="space" align="center">
<button type="submit" name="submit">Submit</button>
</div>
</form>
</div>
<div class="container" style="margin-top: 20px;">
<hr class="hr">
</div>
<!-- ---------------------------------php----------------------------------------- -->
<?php
$host = "localhost";
$dbusername = "root";
$dbpassword = "";
$dbname = "dbphp";
$con = mysqli_connect($host,$dbusername,$dbpassword,$dbname);
if (!$con) {
# code...
die("connection fail....".mysqli_connect_error());
}
if (isset($_POST['submit'])){
$name=$_POST['name'];
$roll=$_POST['roll'];
$eroll=$_POST['eroll'];
$gender=$_POST['gender'];
$depart=$_POST['dep'];
$s=$_POST['sem'];
$sql="insert into stuData(name,roll,eroll,gender,dep,sem) values('$name','$roll','$eroll','$gender','$depart','$s');";
if(mysqli_query($con,$sql)){
?>
<script>
alert('Successfully Save');
window.open('addStudent.php','_self');
</script>
<?php
}
$con->close();
}
?>
<!-- ---------------------------------------------------------------------------- -->
</div>
</body>
</html>