-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_message_teacher.php
85 lines (69 loc) · 3.15 KB
/
create_message_teacher.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<div class="span3" id="">
<div class="row-fluid">
<!-- block -->
<div class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"><h4><i class="icon-pencil"></i> Create Message</h4></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<ul class="nav nav-tabs">
<li>
<a href="teacher_message.php">For Teacher</a>
</li>
<li class="active"><a href="teacher_message_teacher.php">For Student</a></li>
</ul>
<form method="post" id="send_message_student">
<div class="control-group">
<label>To:</label>
<div class="controls">
<select name="student_id" class="chzn-select" required>
<option></option>
<?php
$query = mysqli_query($conn,"select * from teacher_class_student
LEFT JOIN student ON student.student_id = teacher_class_student.student_id
group by teacher_class_student.student_id order by firstname ASC");
while($row = mysqli_fetch_array($query)){
?>
<option value="<?php echo $row['student_id']; ?>"><?php echo $row['firstname']; ?> <?php echo $row['lastname']; ?> </option>
<?php } ?>
</select>
</div>
</div>
<div class="control-group">
<label>Content:</label>
<div class="controls">
<textarea name="my_message" class="my_message" required></textarea>
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-info"><i class="icon-envelope-alt"></i> Send </button>
</div>
</div>
</form>
<script>
jQuery(document).ready(function(){
jQuery("#send_message_student").submit(function(e){
e.preventDefault();
var formData = jQuery(this).serialize();
$.ajax({
type: "POST",
url: "send_message_teacher_to_student.php",
data: formData,
success: function(html){
$.jGrowl("Message Successfully Sended", { header: 'Message Sent' });
var delay = 2000;
setTimeout(function(){ window.location = 'teacher_message.php' }, delay);
}
});
return false;
});
});
</script>
</div>
</div>
</div>
<!-- /block -->
</div>
</div>