-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinsert_result.php
166 lines (139 loc) · 5.08 KB
/
insert_result.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
<?php include("header.php");?>
<?php include('db_con.php');?>
<div class="container-fluid">
<div class="row" id="wrapper">
<?php require_once'menubar.php';?>
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-body">
<center><h1>Insert Result</h1></center>
<hr>
<div class="col-sm-10 col-sm-offset-2">
<?php
if(isset($_POST['submit'])){
$name = $_POST['name'];
$session = $_POST['session'];
$year = $_POST['year'];
$semester = $_POST['semester'];
$roll = $_POST['roll'];
$individual_result = $_POST['individual_result'];
$total_result = $_POST['total_result'];
$grade = $_POST['grade'];
$sql = "INSERT INTO result (name,session,year,semester,roll,individual_result,total_result,grade) VALUES ('$name','$session','$year','$semester','$roll','$individual_result','$total_result','$grade')";
$result = mysqli_query($conn,$sql);
if($result){
echo "<div class='alert alert-success'>";
echo "<strong>Success!</strong> Insert Successfully";
echo "</div>";
}else{
echo "<div class='alert alert-success'>";
echo "<strong>Error!</strong> in submisssion.Please try again.";
echo "</div>";
}
}
?>
<form action="insert_result.php" method="post" class="form-horizontal" role="form">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Student Name:</label>
<div class="col-sm-7">
<input type="text" class="form-control" name="name" placeholder="Student Name">
</div>
</div>
<div class="form-group">
<label for="session" class="col-sm-2 control-label">Session:</label>
<div class="col-sm-7">
<input type="text" class="form-control" name="session" placeholder="Session">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Year:</label>
<div class="col-sm-7">
<select name="year" class="form-control">
<option value="1st">1st</option>
<option value="2nd">2nd</option>
<option value="3rd">3rd</option>
<option value="4th">4th</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Semester:</label>
<div class="col-sm-7">
<select name="semester" class="form-control">
<option value="Odd">Odd</option>
<option value="Even">Even</option>
</select>
</div>
</div>
<div class="form-group">
<label for="roll" class="col-sm-2 control-label">Roll:</label>
<div class="col-sm-7">
<input type="text" name="roll" class="form-control" placeholder="Roll">
</div>
</div>
<div class="form-group">
<label for="individual_result" class="col-sm-2 control-label">Individual Result:</label>
<div class="col-sm-7">
<input type="text" name="individual_result" class="form-control" placeholder="Individual Result(Example:CSE1111-3.50,CSE1112-3.50)">
</div>
</div>
<div class="form-group">
<label for="total_result" class="col-sm-2 control-label">Total Result:</label>
<div class="col-sm-7">
<input type="text" name="total_result" class="form-control" placeholder="Total Result(Example:3.50)">
</div>
</div>
<div class="form-group">
<label for="grade" class="col-sm-2 control-label">Grade:</label>
<div class="col-sm-7">
<input type="text" name="grade" class="form-control" placeholder="Grade(Example:A-)">
</div>
</div>
<center><input type="submit" name="submit" value="Submit" class="btn btn-primary" style="padding: 10px; width: 100px;"></center>
<br>
<br>
</form>
</div>
<?php
echo "<div>";
echo "<table class='table table-bordered'>";
echo "<thead>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>Name</th>";
echo "<th>Session</th>";
echo "<th>Year</th>";
echo "<th>Semester</th>";
echo "<th>Roll</th>";
echo "<th>Individual_result</th>";
echo "<th>Total Result</th>";
echo "<th>Grade</th>";
echo "<th>Actions</th>";
echo "</tr>";
echo "</thead>";
$other=mysqli_query($conn,"SELECT * FROM result");
while ($filter=mysqli_fetch_array($other)) {
echo "<tbody>";
echo "<tr class='success'>";
echo "<td>".$filter['id']."</td>";
echo "<td>".$filter['name']."</td>";
echo "<td>".$filter['session']."</td>";
echo "<td>".$filter['year']."</td>";
echo "<td>".$filter['semester']."</td>";
echo "<td>".$filter['roll']."</td>";
echo "<td>".$filter['individual_result']."</td>";
echo "<td>".$filter['total_result']."</td>";
echo "<td>".$filter['grade']."</td>";
echo '<td><a href="result_update.php?id=' . $filter['id'] . '"><b class="btn btn-warning">Update</b></a>' ;
echo '<a href="result_delete.php?id=' . $filter['id'] . '" onclick=\'return confirm("Are you sure you want to delete this record?")\'><b class="btn btn-danger">Delete</b></a></td>' ;
echo "</tr>";
echo "</tbody>";
}
echo "</table>";
echo "</div>";
?>
</div>
</div>
</div>
</div>
</div>