-
Notifications
You must be signed in to change notification settings - Fork 8
/
students.php
136 lines (129 loc) · 3.85 KB
/
students.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
<?php
/**
* @System HP-pc Rax
* @author Rakshit shah <Rakshitshah1994@gmail.com>
* @copyright 2015-2017 |Rakshit shah
* @license http://rakshit.in/license/license.php | PHP License 3.0
* @version 1.1
* @since File available since Release 1.0.0
*/
include("validation.php");
include("conection.php");
if(isset($_POST["button"]))
{
$sql="INSERT INTO studentdetails (studid, studfname, studlname, dob,fathername, gender, address, contactno,courseid,semester)
VALUES
('$_POST[studid]','$_POST[studfname]','$_POST[studlname]','$_POST[dob]','$_POST[fname]','$_POST[gender]','$_POST[address]','$_POST[contact]','$_POST[course]','$_POST[semester]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
else
{
echo "Record inserted Successfully...";
}
}
$result = mysql_query("SELECT * FROM studentdetails");
$result1 = mysql_query("SELECT * FROM course");
?>
<form name="form1" method="post" action="" id="formID" class="formular">
<p>
<label for="textfield">Student ID</label>
<input type="text" name="studid" id="textid" class="validate[required] text-input">
</p>
<p>
<label for="textfield2">First name</label>
<input type="text" name="studfname" id="textfname" class="validate[required] text-input">
</p>
<p>
<label for="textfield3">Last name</label>
<input type="text" name="studlname" id="textlname" class="validate[required] text-input">
</p>
<p>
<label for="textfield4">Date of birth</label>
<input type="text" name="dob" id="textdob" class="validate[required] text-input">
</p>
<p>
<label for="textfield5">Father's name</label>
<input type="text" name="fname" id="textfield5" class="validate[required] text-input">
</p>
<p>Gender
<input type="radio" name="gender" id="radio" value="Male">
Male
<input type="radio" name="gender" id="radio2" value="Female">
Female
</p>
<p>
<label for="textarea">Address</label>
<textarea name="address" id="textarea" class="validate[required]" cols="45" rows="5"></textarea>
</p>
<p>
<label for="textfield6">Contact No</label>
<input type="text" name="contact" id="textfield6" class="validate[required] text-input">
</p>
<p>
<label for="textfield7">Course </label>
<select name="course">
<option value="">Course Details</option>
<?php
while($row1 = mysql_fetch_array($result1))
{
echo "<option value='$row1[courseid]'>$row1[coursename]</option>";
}
?>
</select>
</p>
<p>
<label for="textfield8">Semester</label>
<label for="select"></label>
<select name="semester" id="select">
<option value="1">First Semester</option>
<option value="2">Second Semester</option>
<option value="3">Third Semester</option>
<option value="4">Fourth Semester</option>
<option value="5">Fifth Semester</option>
<option value="6">Sixth Semester</option>
</select>
</p>
<p>
<input type="submit" name="button" id="button" value="Submit">
<input type="submit" name="button2" id="button2" value="Reset">
</p>
</form>
<p> </p>
<table width="371" border="1">
<tr>
<td width="46">ID</td>
<td width="88">Name</td>
<td width="87">Date of birth</td>
<td width="57">Course</td>
<td width="59">Semester</td>
</tr>
<?php
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td> " . $row['studid'] . "</td>";
echo "<td> " . $row['studfname']. $row['studlname'] . "</td>";
echo "<td> " . $row['dob'] . "</td>";
echo "<td> " . $row['courseid'] . "</td>";
echo "<td> " . $row['semester'] . "</td>";
echo "</tr> ";
}
?>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<p> </p>