-
Notifications
You must be signed in to change notification settings - Fork 0
/
Website_Final_code.php
303 lines (269 loc) · 8.6 KB
/
Website_Final_code.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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Aditya's Classes</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#student_data_collection").submit(function () {
var studentName = $("#name").val();
var address = $("#address").val();
var email = $("#email").val();
var mobileNo = $("#phone").val();
var gender = $("#gender").val();
// validation
if (studentName == "") {
alert("Please enter student name.");
return false;
}
if (address == "") {
alert("Please enter address.");
return false;
}
if (email == "") {
alert("Please enter email.");
return false;
}
if (mobileNo == "") {
alert("Please enter mobile no.");
return false;
}
if (gender == "") {
alert("Please select gender.");
return false;
}
});
});
</script>
<!-- <script type="text/javascript">
document.addEventListener("DOMContentLoaded", function (event) {
const form = document.getElementById('student_data_collection');
const formData = new FormData(form);
console.log("At line 46: ", formData);
fetch('assignment.php', {
method: 'POST',
body: {name:'Aditya',email:'[email protected]',gender:'Male',address:"IIT Patna",phone:9876543210}
})
.then(response => response.text())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
});
</script> -->
<!-- <script type="text/javascript">
document.addEventListener("DOMContentLoaded", () => {
const button = document.getElementById('submit-button');
button.addEventListener('click', (e) => {
e.preventDefault();
console.log("entered");
const form = document.getElementById('student_data_collection');
const formData = new FormData(form);
console.log("At line 69: ", formData);
fetch('assignment.php', {
method: 'POST',
body: formData
})
.then(response => response.text())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
})
})
</script> -->
</head>
<link href="https://fonts.googleapis.com/css?family=Baloo+Bhai&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
<style>
/* CSS Reset */
body {
font-family: sans-serif;
color: rgb(15, 171, 237);
background: url(https://wallpaperaccess.com/full/6367135.jpg);
background-repeat: no-repeat;
background-size: cover;
}
p {
color: rgb(16, 52, 54);
}
.left {
display: inline-block;
/* border: 2px solid red; */
font-weight: bold;
font-size: large;
position: absolute;
left: 60px;
top: 28px;
}
/* .left img {
width: 136px;
/* filter: invert(100%); */
/* } */
.left div {
line-height: 19px;
font-size: 32px;
text-align: center;
}
.mid {
display: block;
width: 40%;
margin: auto;
top: 10px;
/* border: 2px solid green; */
}
.right {
position: absolute;
right: 34px;
top: 36px;
/* background-color: ; */
display: inline-block;
/* border: 2px solid yellow; */
}
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 5px;
top: 20px;
}
.navbar li {
display: flex;
font-size: 15px;
/* flex-grow: 1; */
/* text-align: center; */
margin: auto;
margin-top: 0px;
}
.navbar li a {
color: rgb(14, 225, 236);
text-decoration: none;
padding: 34px 23px;
}
.navbar li a:hover,
.navbar li a.active {
text-decoration: underline;
color: rgb(4, 71, 80);
}
.btn {
font-family: 'Baloo Bhai', cursive;
margin: 0px 9px;
background-color: rgb(7, 80, 84);
color: rgb(255, 255, 255);
padding: 4px 14px;
border: 2px solid rgb(128, 128, 128);
border-radius: 10px;
font-size: 20px;
cursor: pointer;
}
.btn:hover {
background-color: rgb(1, 49, 55);
}
.container {
border: 2px solid rgb(17, 13, 13);
/* border of form box */
margin: 100px 80px;
padding: 75px;
width: 33%;
border-radius: 28px;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
margin-bottom: 5px;
}
.form-group input,
.form-group select {
font-family: serif;
font-weight: bold;
width: 100%;
padding: 10px;
border-radius: 5px;
border: 1px solid #ccc;
}
.form-group select {
height: 40px;
}
.form-group input:focus,
.form-group select:focus {
outline: none;
border-color: rgb(15, 171, 237);
}
.container h1 {
text-align: center;
color: rgb(33, 168, 231);
}
.container button {
display: block;
width: 74%;
margin: 20px auto;
}
</style>
<body>
<header class="header">
<!-- Left box for logo -->
<div class="left">
<img src="img/gym.png" alt="">
<div>Learners Point</div>
</div>
<!-- Mid box for navbar -->
<div class="mid">
<ul class="navbar">
<li><a href="#">Home</a></li>
<!-- class="active" -->
<li><a href="#">About Us</a></li>
<li><a href="#">Achievements</a></li>
<li><a href="#">Scorecard</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</div>
<!-- Right box for buttons -->
<div class="right">
<button class="btn">Call Us Now</button>
<button class="btn">Email Us</button>
</div>
</header>
<div class="container">
<h1>Make your Future Bright - Join Learners Point </h1>
<form id="student_data_collection" method="POST" action="assignment.php">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
</div>
<div class="form-group">
<label for="address">Address:</label>
<input type="text" id="address" name="address" required>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
</div>
<div class="form-group">
<label for="phone">Phone:</label>
<input type="text" id="phone" name="phone" required>
</div>
<div class="form-group">
<label for="gender">Gender:</label>
<select id="gender" name="gender" required>
<option value="">Select Gender</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</div>
<div class="form-group">
<button type="submit" class="btn" id="submit-button" name="button">Submit</button>
</div>
</form>
</div>
</body>
</html>