-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_class_event.php
66 lines (51 loc) · 2.69 KB
/
add_class_event.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
<form id="signin_student" class="form-signin" method="post">
<h4 class="form-signin-heading"><i class="icon-plus-sign"></i> Add Event</h4>
<input type="text" class="input-block-level datepicker" name="date_start" id="date01" placeholder="Date Start" required/>
<input type="text" class="input-block-level datepicker" name="date_end" id="date01" placeholder="Date End" required/>
<input type="text" class="input-block-level" id="username" name="title" placeholder="Title" required/>
<button id="signin" name="add" class="btn btn-info" type="submit"><i class="icon-save"></i> Save</button>
</form>
<?php
if (isset($_POST['add'])){
$date_start = $_POST['date_start'];
$date_end = $_POST['date_end'];
$title = $_POST['title'];
$query = mysqli_query($conn,"insert into event (date_end,date_start,event_title,teacher_class_id) values('$date_end','$date_start','$title','$get_id')")or die(mysqli_error());
?>
<script>
window.location = "class_calendar.php<?php echo '?id='.$get_id; ?>";
</script>
<?php
}
?>
<table cellpadding="0" cellspacing="0" border="0" class="table" id="">
<?php //include('move_to_school_year.php'); ?>
<thead>
<tr>
<th>Event</th>
<th>Date</th>
<th></th>
</tr>
</thead>
<tbody>
<?php $event_query = mysqli_query($conn,"select * from event where teacher_class_id = '$get_id' ")or die(mysqli_error());
while($event_row = mysqli_fetch_array($event_query)){
$id = $event_row['event_id'];
?>
<tr id="del<?php echo $id; ?>">
<td><?php echo $event_row['event_title']; ?></td>
<td><?php echo $event_row['date_start']; ?>
<br>
<?php echo $event_row['date_end']; ?>
</td>
<td width="40">
<form method="post" action="delete_class_event.php">
<input type="hidden" name="get_id" value="<?php echo $get_id; ?>">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<button class="btn btn-danger" name="delete_event"><i class="icon-remove icon-large"></i></button>
</form>
</td>
</tr>
<?php } ?>
</tbody>
</table>