-
Notifications
You must be signed in to change notification settings - Fork 1
/
studentdetails.php
144 lines (125 loc) · 4.47 KB
/
studentdetails.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
<?php
include"dbconnect.php";
if(isset($_POST['reg'])){
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$gender=$_POST['gender'];
$tel=$_POST['tel'];
$paddress=$_POST['address'];
if ($_POST['fname']=='' or $_POST['lname']==''or $_POST['gender']=='' or $_POST['tel']=='' or $_POST['paddress']=='') {
echo "One or more required fields were left blank. Please fill them in and try again.";
}
elseif(!preg_match("/[a-zA-Z0-9]/",$fname)) { //check if First Name is valid
echo"First Name is not Valid.";
}
elseif(!preg_match("/[a-zA-Z0-9]/",$lname)) { //check if Last Name is valid
echo"Last Name is not Valid.";
}
elseif(!preg_match("/[0-9]/",$tel)) { //check if Telephone Number is valid
echo"Telephone Number is not Valid.";
}
else{
$q2="INSERT INTO customers (fname,lname,gender,telephone,postaddress) VALUES('$fname','$lname','$gender','$tel','$paddress')";
$r2= mysql_query($q2, $link);
if($r2){
echo"Customer has been Registered.";
}else{
echo"Database Error.";
}
}
}else{
?>
<!DOCTYPE html>
<html>
<head>
<title>X high school</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<div id="header">
<!--div class="nav">
<nav>
<a href="index.html">Home</a>
<a href="" >Finance</a>
<a href="">Academics</a>
<a href="">News</a>
</nav>
</div-->
</div>
<div>
<h2>Student details</h2>
<div>
<form>
<fieldset>
<legend>Profile</legend>
<table>
<form>
<tr>
<td><label>Admission number:</label></td><td><input type="text" name="admnno"/></td>
</tr>
<tr>
<td><label>Surname:</label></td><td><input type="text" name="sname"/></td>
</tr>
<tr>
<td><label>First Name:</label></td><td><input type="text" name="fname"/></td>
</tr>
<tr>
<td><label>Last Name:</label></td><td><input type="text" name="lname"/></td>
</tr>
<tr>
<td><label>Date of Admission:</label></td><td><input type="text" name="adm"/></td>
</tr>
</table>
<table>
<tr><td><label>Date of birth:</label><label>Day</label><input type="text" name="day"/><label>Month:</label><input type="text" name="mon"/><label>Year</label><input type="text" name="year"/></td>
</tr>
<label>Form</label><select>
<option>Form 1</option>
<option>Form 2</option>
<option>Form 3</option>
<option>Form 4</option>
</select>
</table>
<label> Gender </label><input type="radio" name="gender" value="male">
<input type="radio" name="gender" value="female"><br>
</fieldset>
<br>
<fieldset>
<legend>Parent Details</legend>
<table>
<tr>
<td><label>Surname:</label></td><td><input type="text" name="psname"/></td>
</tr>
<tr>
<td><label>First Name:</label></td><td><input type="text" name="pfname"/></td>
</tr>
<tr>
<td><label>Last Name:</label></td><td><input type="text" name="plname"/></td>
</tr>
<tr>
<td><label>Id no:</label></td><td><input type="text" name="id"/></td>
</tr>
<tr>
<td>
<label>Residence:</label></td><td><input type="text" name="psname"/></td>
</tr>
<tr>
<td>
<label>Email:</label></td><td><input type="text" name="email"/></td>
</tr>
<tr>
<td>
<label>Telephone:</label></td><td><input type="text" name="tel"/></td>
</tr>
</table>
</fieldset>
<input type="submit" name="submit" value="Submit Details"/>
</form>
</div>
</div>
<div>
</div>
</body>
</html>
<?}?>