-
Notifications
You must be signed in to change notification settings - Fork 1
/
add.php
252 lines (196 loc) · 10.2 KB
/
add.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<?php
include 'connect.php';
if (isset($_POST['submit'])){
$firstname =$_POST['fname'];
$lastname =$_POST['lname'];
$mobile =$_POST['phone'];
$email =$_POST['email'];
$fathername =$_POST['fathername'];
$gender =$_POST['gender'];
$collegename =$_POST['collegename'];
$paddress =$_POST['paddress'];
$ppostoffice =$_POST['ppostoffice'];
$pdistrict =$_POST['pdistrict'];
$pstate =$_POST['pstate'];
$ppin =$_POST['ppin'];
$raddress =$_POST['raddress'];
$rpostoffice =$_POST['rpostoffice'];
$rdistrict =$_POST['rdistrict'];
$rstate =$_POST['rstate'];
$rpin =$_POST['rpin'];
if ($firstname!="" && $lastname!="" && $mobile!="" ){
$sql = "SELECT * FROM studentlist WHERE email='$email'";
$result = mysqli_query($conn, $sql);
if($result){
$q = "SELECT * FROM studentlist WHERE mobile='$mobile'";
$result = mysqli_query($conn,$q);
if (!$result->num_rows > 0) {
$sql = "INSERT INTO studentlist (firstname, lastname, mobile, email, fathername, gender, collegename, paddress, ppostoffice, pdistrict, pstate, ppin, raddress, rpostoffice, rdistrict, rstate, rpin)
VALUES ('$firstname','$lastname','$mobile','$email','$fathername','$gender', '$collegename','$paddress','$ppostoffice','$pdistrict','$pstate','$ppin','$raddress','$rpostoffice','$rdistrict','$rstate','$rpin')";
$result=mysqli_query($conn,$sql);
if ($result) {
echo "<script>alert('Wow! User Registration Completed.')</script>";
} else {
echo "<script>alert('Woops! Database Errort.')</script>";
}
}else{
echo "<script>alert('Email or Mobile No. Already Exists.')</script>";
}
}
}else{
echo "<script>alert('Empty! Please Fill All The Required Filled.')</script>";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="style.css">
<title>Monowar Login Form</title>
</head>
<header>
<nav class="navbar navbar-expand bg-light navbar-light navbar-fixed-top ">
<a class="navbar-brand" href="index.php">Monowar</a>
<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item active"><a class="nav-link" href="index.php">Home</a></li>
<button type="button" class="btn btn-primary mx-2" onclick="window.location.href='add.php';">Add Student</button>
<button type="button" class="btn btn-primary" onclick="window.location.href='index.php';">Dashboard</button>
</ul>
</nav>
</header>
<body>
<div class="container">
<div class="header">
<h2>Add Students</h2>
<h4>A Form to Add Students, Update,Delete and List student Data.</h4>
<h5>C-DAC Assignment-01 by Monowar Hussain</h5>
</div>
<div class="form" id="form">
<form action="" onsubmit="" method="POST">
<div class="form-control1 ">
<label>First Name</label>
<input type="text" id="fname" name="fname" placeholder="Enter Your First Name" required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1 ">
<label>Last Name</label>
<input type="text" id="lname" name="lname" placeholder="Enter Your Last Name"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Mobile Number</label>
<input type="number" id="phone" name="phone" placeholder="Enter Your Mobile Number"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Email</label>
<input type="email" id="email" name="email" placeholder="Enter Your Email ID" required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Father's Name</label>
<input type="text" id="fathername" name="fathername" placeholder="Enter Your Father's Name"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Gender</label>
<input type="text" id="gender" name="gender" placeholder="Enter Your Gender"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>College Name</label>
<input type="text" id="collegename" name="collegename" placeholder="Enter Your College Name"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<!--Residential Addres-->
<div class="float-container">
<div class="raddress" >
<div class="raddressHeader"><h3>Residential Address</h3>
</div>
<div class="form-control1">
<label>Adress</label>
<input type="text" id="raddress" name= "raddress" placeholder="Enter Your Address" required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Post Office</label>
<input type="text" id="rpostoffice" name="rpostoffice" placeholder="Enter Your Post Office" required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>District</label>
<input type="text" id="rdistrict" name="rdistrict" placeholder="Enter Your District Name"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>State</label>
<input type="text" id="rstate" name="rstate" placeholder="Enter Your State Name" required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Pin</label>
<input type="number" id="rpin" name="rpin" placeholder="Enter Your PIN " required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
</div>
<!--Permanent Addres-->
<div class="paddress" >
<div class="paddressHeader"><h3>Permanent Address</h3>
<input type="checkbox" id="checkBox" name="checkBox" onchange="addressFunction()"> Same as Residential</div>
<div class="form-control1">
<label>Adress</label>
<input type="text" id="paddress" name="paddress" placeholder="Enter Your Address" required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Post Office</label>
<input type="text" id="ppostoffice" name="ppostoffice" placeholder="Enter Your Post Office" >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>District</label>
<input type="text" id="pdistrict" name="pdistrict" placeholder="Enter Your District Name" required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>State</label>
<input type="text" id="pstate" name="pstate" placeholder="Enter Your State Name"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Pin</label>
<input type="number" id="ppin" name="ppin" placeholder="Enter Your PIN "required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
</div>
</div>
<button name="submit" class="btn">Submit</button>
</form>
</div>
</div>
<script src="script.js"></script>
</body>
</html>