-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcourse_insert.php
More file actions
139 lines (118 loc) · 5 KB
/
Copy pathcourse_insert.php
File metadata and controls
139 lines (118 loc) · 5 KB
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
<?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">
<div class="col-sm-10 col-sm-offset-2">
<center><h3>Insert Syllebus</h3></center>
<br>
<?php
if(isset($_POST['submit'])){
$course_code = $_POST['course_code'];
$course_name = $_POST['course_name'];
$type = $_POST['type'];
$year = $_POST['year'];
$credit = $_POST['credit'];
if($course_code!=NULL && $course_name!=NULL && $type!=NULL && $year!=NULL && $credit!=NULL){
$sql = "INSERT INTO course (course_code,name,type,year,credit) VALUES ('$course_code','$course_name','$type','$year','$credit')";
$result = mysqli_query($conn,$sql);
if(!$result){
echo "<div class='alert alert-danger'>";
echo "<strong>Error!</strong> in submisssion.Please try again.";
echo "</div>";
}else{
echo "<div class='alert alert-success'>";
echo "<strong>Success!</strong> Insert Successfully";
echo "</div>";
}
}
}
?>
<form action="course_insert.php" method="post" class="form-horizontal" role="form">
<div class="form-group">
<label for="course_code" class="col-sm-2 control-label">Course Code</label>
<div class="col-sm-7">
<input type="text" class="form-control" name="course_code" placeholder="Enter course code" >
</div>
</div>
<div class="form-group">
<label for="course_name" class="col-sm-2 control-label">Course Name</label>
<div class="col-sm-7">
<input type="text" class="form-control" name="course_name" placeholder="Enter course name" >
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Course Type</label>
<div class="col-sm-7">
<select class="form-control" name="type">
<option value="Theory">Theory</option>
<option value="Lab">Lab</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Year</label>
<div class="col-sm-7">
<select class="form-control" name="year">
<option value="1-1">1-1</option>
<option value="1-2">1-2</option>
<option value="2-1">2-1</option>
<option value="2-2">2-2</option>
<option value="3-1">3-1</option>
<option value="3-2">3-2</option>
<option value="4-1">4-1</option>
<option value="4-2">4-2</option>
</select>
</div>
</div>
<div class="form-group">
<label for="credit" class="col-sm-2 control-label">Credit</label>
<div class="col-sm-7">
<input type="text" class="form-control" name="credit" placeholder="Enter Course Credit">
</div>
</div>
<center><input type="submit" name="submit" value="Submit" class="btn btn-primary" style="padding: 10px; width: 100px;"></center>
</form>
<br>
<br>
<br>
</div>
<center><h3>Update Syllebus</h3></center>
<?php
$sql1 = "SELECT * FROM course";
$result1 = mysqli_query($conn,$sql1);
echo "<table class='table table-bordered'>";
echo "<thead>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>Course Code</th>";
echo "<th>Course Name</th>";
echo "<th>Type</th>";
echo "<th>Year</th>";
echo "<th>Credit</th>";
echo "<th>Actions</th>";
echo "</tr>";
echo "</thead>";
while ($row1 = mysqli_fetch_assoc($result1)) {
echo "<tbody>";
echo "<tr class='success'>";
echo "<td>".$row1['co_id']."</td>";
echo "<td>".$row1['course_code']."</td>";
echo "<td>".$row1['name']."</td>";
echo "<td>".$row1['type']."</td>";
echo "<td>".$row1['year']."</td>";
echo "<td>".$row1['credit']."</td>";
echo '<td><a href="course_update.php?id=' . $row1['co_id'] . '"><b class="btn btn-warning">Update</b></a>' ;
echo '<a href="delete.php?id=' . $row1['co_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>";
?>
</div>
</div>
</div>
</div>