-
Notifications
You must be signed in to change notification settings - Fork 1
/
institute.php
394 lines (344 loc) · 11 KB
/
institute.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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
<?php
include("header.php");
include("connection.php");
?>
<script language="javascript">
function validate()
{
var x=document.form1.emailid.value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if(document.form1.instituteid.value=="")
{
alert("Please enter institution id");
return false;
}
else if(document.form1.instituteid.value.length>6)
{
alert("institute id must be of 6 or less than 6 characters");
document.form1.instituteid.focus();
return false;
}
if(document.form1.institutetype.value=="")
{
alert("Please enter institution type");
return false;
}
else if(document.form1.institutename.value=="")
{
alert("Please enter institution name");
document.form1.institutename.focus();
return false;
}
else if(document.form1.address.value=="")
{
alert("Please enter Address");
document.form1.address.focus();
return false;
}
else if(document.form1.pincode.value=="")
{
alert("Please enter Pincode");
document.form1.pincode.focus();
return false;
}
else if(document.form1.pincode.value.length>6)
{
alert("Please enter valid pincode");
document.form1.pincode.focus();
return false;
}
else if(document.form1.telephone.value=="")
{
alert("Please enter phone number");
document.form1.telephone.focus();
return false;
}
else if(document.form1.telephone.value.length>11)
{
alert("Please enter phone valid number");
document.form1.telephone.focus();
return false;
}
else if(document.form1.emailid.value=="")
{
alert("Please enter the email id");
document.form1.emailid.focus();
return false;
}
else if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
{
alert("Not a valid e-mail address");
return false;
}
else if(document.form1.website.value=="")
{
alert("Please enter the website id");
document.form1.website.focus();
return false;
}
else if(document.form1.areatype.value=="")
{
alert("Please enter area type");
document.form1.areatype.focus();
return false;
}
else if(document.form1.totalpopulation.value=="")
{
alert("Please enter total population");
document.form1.totalpopulation.focus();
return false;
}
else if(document.form1.yearofestablishment.value=="")
{
alert("Please enter year of establishment");
document.form1.yearofestablishment.focus();
return false;
}
else if(document.form1.catholics.value=="")
{
alert("Please enter Catholics");
document.form1.catholics.focus();
return false;
}
else if(document.form1.otherchristians.value=="")
{
alert("Please enter Otherchristians");
document.form1.otherchristians.focus();
return false;
}
else if(document.form1.hindus.value=="")
{
alert("Please enter Hindus");
document.form1.hindus.focus();
return false;
}
else if(document.form1.muslims.value=="")
{
alert("Please enter Muslims");
document.form1.muslims.focus();
return false;
}
else if(document.form1.others.value=="")
{
alert("Please enter Others");
document.form1.others.focus();
return false;
}
else if(document.form1.schoolstatus.value=="")
{
alert("Please enter Schoolstatus");
document.form1.schoolstatus.focus();
return false;
}
else if(document.form1.medium.value=="")
{
alert("Please enter Medium");
document.form1.medium.focus();
return false;
}
else if(document.form1.area.value=="")
{
alert("Please enter Area");
document.form1.area.focus();
return false;
}
else if(document.form1.schooltype.value=="")
{
alert("Please enter Schooltype");
document.form1.schooltype.focus();
return false;
}
}
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
//alert(charCode);
if (charCode > 65 && charCode < 91 )
{
return true;
}
else if (charCode > 96 && charCode < 122 )
{
return true;
}
else
{
alert("should be alphabet");
return false;
}
}
</script>
<?php
$dt = date("Y-m-d");
if(isset($_POST[Update]))
{
$serialized_data = serialize(array($_POST[catholics], $_POST[otherchristians], $_POST[hindus], $_POST[muslims], $_POST[others]));
$sql="INSERT INTO institute(inst_id,inst_type, inst_name,address,telephone,pincode,email,website,area_type,total_population,year_ofestabl,school_status,medium,area,school_type,populationcommwise)
VALUES
('$_POST[instituteid]','$_POST[institutetype]','$_POST[institutename]','$_POST[address]','$_POST[telephone]','$_POST[pincode]','$_POST[emailid]','$_POST[website]','$_POST[areatype]','$_POST[totalpopulation]','$_POST[yearofestablishment]','$_POST[schoolstatus]','$_POST[medium]','$_POST[area]','$_POST[schooltype]','$serialized_data')";
if (!mysqli_query($con,$sql,$con))
{
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
}
?>
<div id="main">
<div id="content" class="left">
<div class="highlight">
<h3>Add Institution</h3>
<form id="form1" name="form1" method="post" action="" onsubmit="return validate()" >
<p><a href="viewinstitution.php"><strong>View Institution</strong></a></p>
<table width="614" border="0">
<tr>
<td width="154" height="31" scope="col">Institute ID</th>
<td colspan="3" scope="col"><input name="instituteid" type="text" id="instituteid" size="50" /></th>
</tr>
<tr>
<td height="36"><label for="institutetype">Institute type</label></td>
<td colspan="3"><select name="institutetype" id="institutetype">
<option value="">Select Institution type</option>
<option value="Primary school" >Primary school</option>
<option value="High school">High school</option>
<option value="PUC">PUC</option>
</select></td>
</tr>
<tr>
<td height="32">Institute name</td>
<td colspan="3"><input type="text" name="institutename" id="institutename" /></td>
</tr>
<tr>
<td height="95"><label for="address2">Address</label></td>
<td colspan="3"><textarea name="address" id="address" cols="45" rows="5"></textarea></td>
</tr>
<tr>
<td height="39">Pincode </td>
<td colspan="3"><input name="pincode" type="text" id="pincode" size="25" /></td>
</tr>
<tr>
<td height="38">Telephone</td>
<td colspan="3"><input name="telephone" type="text" id="telephone" size="25" /></td>
</tr>
<tr>
<td height="36">Emailid</td>
<td colspan="3"><input name="emailid" type="text" id="emailid2" size="50" /></td>
</tr>
<tr>
<td height="33">Website</td>
<td><input name="website" type="text" id="website" size="25" /></td>
<td align="right">Area type</td>
<td align="left"><select name="areatype" id="areatype">
<option value="">area type</option>
<option value="rural">Rural</option>
<option value="urban">Urban</option>
</select></td>
</tr>
<tr>
<td height="25">Total population</td>
<td><input type="text" name="totalpopulation" id="totalpopulation" /></td>
<td align="right">Year of establishment</td>
<td align="left"><select name="yearofestablishment" id="yearofestablishment">
<option value="">select</option>
<?php
for($i=1970; $i<= 2012; $i++)
{
echo "<option value=$i>$i</option>";
}
?>
</select></td>
</tr>
<tr>
<td height="221" valign="top"><p>Population communitywise</p></td>
<td colspan="3">
<table width="277" height="185" border="0">
<tr>
<td width="140" height="41">Catholics</td>
<td width="127"><input name="catholics" type="text" id="catholics" size="10" /></td>
</tr>
<tr>
<td height="35">Other Christians</td>
<td><input name="otherchritians" type="text" id="otherchristians" size="10" /></td>
</tr>
<tr>
<td height="34">Hindus</td>
<td><input name="hindus" type="text" size="10" /></td>
</tr>
<tr>
<td height="39">Muslims</td>
<td><input name="muslims" type="text" id="muslims" size="10" /></td>
</tr>
<tr>
<td height="24">Other</td>
<td><input name="others" type="text" id="others" size="10" /></td>
</tr>
</table></td>
</tr>
<tr>
<td height="33"><label for="schoolstatus2">School Status </label></td>
<td width="154"><select name="schoolstatus" id="schoolstatus">
<option value="">Select</option>
<option value="own">own</option>
<option value="rented">rented</option>
</select></td>
<td width="134" align="right">Medium</td>
<td width="135" align="left"><select name="medium" id="medium">
<option value="">Select</option>
<option value="English">English</option>
<option value="Kannada">Kannada</option>
</select></td>
</tr>
<tr>
<td height="30">Area</td>
<td><input type="text" name="area" id="area" />
<br />
(in Sq. Ft)</td>
<td align="right">School type</td>
<td align="left"><select name="schooltype" id="schooltype">
<option value="">Select</option>
<option value="aided">aided</option>
<option value="unaided">unaided</option>
</select></td>
</tr>
<tr>
<td> </td>
<td colspan="3"> </td>
</tr>
<tr>
<td colspan="4"><input type="submit" name="Update" id="Update" value="Add " /></td>
</tr>
</table>
<p>
<label for="emailid2"></label>
<label for="schooltype"></label>
</p>
</form>
<p> </p>
</div>
<div class="projects">
<div class="item"></div>
<div class="item">
<div class="cl"> </div>
</div>
</div>
</div>
<div id="sidebar" class="right">
<?php
include("sidebar.php"); ?>
<div class="advertisement">
<h3> </h3>
<div class="ads">
<div class="cl"> </div>
</div>
</div>
<div class="info"></div>
</div>
<div class="cl"> </div>
</div>
<div class="shadow-l"></div>
<div class="shadow-r"></div>
<div class="shadow-b"></div>
</div>
<?php
include("footer.php");
?>