-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsert_course.php
More file actions
144 lines (114 loc) · 5.25 KB
/
insert_course.php
File metadata and controls
144 lines (114 loc) · 5.25 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
<?php
// include 'db_conn.php';
// error_reporting(0);
// session_start();
// if (isset($_POST['submit'])) {
// $sql = "create table if not exists course_structure( id varchar(10) primary key,outcomes varchar(100),
// text varchar(250),department varchar(100))";
// $result = mysqli_query($conn, $sql);
// $outcomes = $_POST['outcomes'];
// $id = $_POST['id'];
// $text = $_POST["text"];
// $department = $_SESSION['department'];
// $sql = "insert into course_structure values('$id','$outcomes','$text','$department');";
// $result = mysqli_query($conn, $sql);
// if (!$result) {
// $sql = "update course_structure set outcomes ='$outcomes',text='$text',department='$department' where id='$id'";
// $result1 = mysqli_query($conn, $sql);
// echo "<script>alert('Updated Successfully')</script>";
// if ($result1) {
// echo "<script>alert('Added Successfully')</script>";
// header("Location: course_structure_dashboard.php");
// }
// } else if($result) {
// header("Location: course_structure_dashboard.php");
// }else{
// echo "<script>alert('Error')</script>";
// }
// }
include 'db_conn.php';
error_reporting(0);
session_start();
$sql = "create table if not exists course_structure(id int not null auto_increment primary key, outcomess varchar(100),
idd varchar(20),
textt varchar(300)
)";
$result = mysqli_query($conn, $sql);
// $sql= "insert into announcement values(0,'0','0','0','0','0','0');";
// mysqli_query($conn, $sql);
if (isset($_POST['submit'])) {
$outcomes = $_POST['outcomes'];
$id = $_POST['id'];
$text = $_POST['text'];
$sql ="insert into course_structure(outcomess,idd,textt) values('$outcomes','$id','$text')";
$result = mysqli_query($conn, $sql);
if ($result) {
try{
$login_tym = $_SESSION["login_tym"] ;
$emp_id = $_SESSION["empid"] ;
$sql = "select * from log_details where login_tym ='$login_tym' and emp_id ='$emp_id' ";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
$action = $row['action'];
$form = $row['form'];
$t1 = $action.",inserted course";
$t2 = $form.", course form";
$sql = "update log_details set action = '$t1', form = '$t2' where login_tym ='$login_tym' and emp_id ='$emp_id'";
$result = mysqli_query($conn,$sql);
echo '<div class="alert alert-success alert-dismissable" id="flash-msg" style="margin-top:70px">
<h4>course added successfully</h4>
</div>';
}
catch(e)
{
echo e;
}
}
}
?>
<?php
include 'appsidebar.php'
?>
<h2 class="ms-3"><b>Course Structure</b></h2>
<div class="main-card m-3 card min-vh-50" style="min-height:60%">
<div class="card-body">
<form action="" method="POST">
<div class="row justify-content-start">
<div class="col-md-3">
<label for="name" class="form-label mt-3">Outcomes</label>
<select id="outcomes" class="form-select" name="outcomes" value="<?php echo $outcomes; ?>">
<option selected>Choose...</option>
<option value="PROGRAM OUTCOMES">PROGRAM OUTCOMES</option>
<option value="PROGRAM SPECIFIC OUTCOMES">PROGRAM SPECIFIC OUTCOMES</option>
<option value="PROGRAM EDUCATIONAL OBJECTIVES">PROGRAM EDUCATIONAL OBJECTIVE</option>
</select>
</div>
<div class="col-md-3">
<label for="name" class="form-label mt-3 ">Id</label>
<input type="text" class="form-control" id="id" name="id" value="<?php echo $id; ?>">
</div>
<div class="col-md-3">
<label for="name" class="form-label mt-3">Text</label>
<textarea class="form-control" id="text" name="text" rows="3"><?php echo $text ?></textarea>
</div>
</div>
<div class="row">
<div class="col mt-3">
<button type="Submit" class="btn btn-primary btn-lg" name="submit">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
<script>
const alertBox = document.getElementById("flash-msg");
setTimeout(() => {
alertBox.style.display = "none";
}, 3000);
</script>
</body>
</html>
<?php
include 'endtags.php'
?>