-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddnotices.php
38 lines (35 loc) · 1.16 KB
/
addnotices.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
<?php
include('include/session.php');
include('include/header.php');
include('include/navbar.php');
if(count($_POST)>0){
isset($_POST['sem']) ? $sem=$_POST['sem']:$sem="";
isset($_POST['title']) ? $title=$_POST['title']:$title="";
isset($_POST['sub']) ? $sub=$_POST['sub']:$sub="";
isset($_POST['desc']) ? $desc=$_POST['desc']:$desc="";
isset($_POST['file']) ? $file=$_POST['file']:$file="";
if(count($_POST)>0){
$uid = $_SESSION['id'];
$date = new DateTime();
$time = $date->format('Y-m-d H:i:s');
$rs=mysqli_query($conn, "INSERT INTO `notices` (`id`, `uid`, `sem`, `title`, `sub`, `desc`, `file`, `timestamp`) VALUES (NULL, '$uid', '$sem', '$title', '$sub', '$desc', '$file','$time')");
if($rs){
?>
<div class="alert alert-success">
<strong>Success!</strong> Your registration is successfull.
</div>
<?php
$msg="Notice successfully added.";
header("Location: teacherdashboard.php?msg='$msg'");
}
else{
?>
<div class="alert alert-danger">
<strong>Sorry!</strong> You Are Unable To Add Notice.
</div>
<?php
$msg="You Are Unable To Add Notice.";
}
}
}
?>