-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit_course.php
More file actions
155 lines (128 loc) · 6.22 KB
/
edit_course.php
File metadata and controls
155 lines (128 loc) · 6.22 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
include("connect.php");
$course_id = $_REQUEST['course_id'];
$query = "SELECT * from courses where course_id='" . $course_id . "'";
$result = mysqli_query($con, $query) or die(mysqli_error($con));
$row = mysqli_fetch_assoc($result);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>edit_Course</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<style>
body {
background-color: #000;
color: #ffffff;
}
.myform {
color: #ffffff;
margin: 100px 320px;
background-color: #000;
border-radius: 15px;
border: 1px solid white;
}
.myform h1 {
padding-bottom: 10px;
padding-top: 10px;
/* text-shadow: 10px 10px 30px #dedbdb66; */
}
.myform label {
font-size: 20px;
font-weight: 600;
letter-spacing: 1px;
padding-left: 40px;
}
.tabledata {
padding-top: 10px;
padding-bottom: 20px;
padding-right: 70px;
}
#inputbox {
width: 110%;
}
.other-link a {
margin: 5px 30px;
text-decoration: none;
text-transform: uppercase;
padding: 13px 25px;
background-color: #198754;
color: white;
border-radius: 8px;
font-size: 19px;
transition: background-color 0.3s;
}
.other-link a:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="myform">
<?php
$status = "";
if (isset($_POST['new']) && $_POST['new'] == 1) {
$course_id = $_REQUEST['course_id'];
$course_name = $_REQUEST['course_name'];
$course_type = $_REQUEST['course_type'];
$duration = $_REQUEST['duration'];
$intake = $_REQUEST['intake'];
$eligibility = $_REQUEST['eligibility'];
$update = "update courses set course_name='" . $course_name . "', course_type='" . $course_type . "',duration='" . $duration . "',intake='" . $intake . "',eligibility='" . $eligibility . "'where course_id='" . $course_id . "'";
mysqli_query($con, $update) or die(mysqli_error($con));
$status = "Course Updated Successfully. </br></br>
<a href='adminview_course.php'>View Updated course record</a>";
echo '<p style="color:#FF0000;">' . $status . '</p>';
} else {
?>
<div>
<form name="form" method="post" action="">
<input type="hidden" name="new" value="1" />
<h1 style="font-family: Algerian;" align="center">COURSES</h1>
<input name="course_id" type="hidden" value="<?php echo $row["course_id"]; ?>" />
<table>
<tr>
<td class="tabledata">
<label for="course_name">Name of Courses:</label>
</td>
<td class="tabledata"> <input id="inputbox" type="text" name="course_name" placeholder="Enter course name" required value="<?php echo $row['course_name']; ?>" /></td>
</tr>
<tr>
<td class="tabledata"><label for="type"> Type:</label></td>
<td class="tabledata"><label for="course_type">Normal</label>
<input type="radio" id="normal" name="course_type" value="normal" <?php if ($row["course_type"] == "normal") { ?> checked="true" <?php } ?> />
<label for="course_type">LEET</label>
<input type="radio" id="leet" name="course_type" value="leet" <?php if ($row["course_type"] == "leet") { ?> checked="true" <?php } ?> />
</td>
</tr>
<tr>
<td class="tabledata"><label for="duration">Duration:</label></td>
<td class="tabledata"> <input id="inputbox" type="text" name="duration" placeholder="Enter duration" required value="<?php echo $row['duration']; ?>" /></td>
</tr>
<tr>
<td class="tabledata"><label for="intake">Intake:</label></td>
<td class="tabledata"><input id="inputbox" type="number" name="intake" placeholder="Enter intake value" required value="<?php echo $row['intake']; ?>" /></td>
</tr>
<tr>
<td class="tabledata"><label for="eligibility">Eligibility:</label></td>
<td class="tabledata"> <input id="inputbox" type="text" name="eligibility" placeholder="Enter eligibility" required value="<?php echo $row['eligibility']; ?>" /></td>
</tr>
<br>
</table>
<br>
<p>
<input style=" margin:0px 30px; padding:10px 50px;" class="btn btn-lg btn-success" type="submit" value="Submit" />
<span class="other-link"> <a href="addcourses.php">add New course</a></span>
</p>
<p style="color:#228B22;"><?php echo $status; ?></p>
<br>
</form>
<?php } ?>
</div>
</div>
</body>
</html>