-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_message_student.php
96 lines (67 loc) · 2.98 KB
/
create_message_student.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
86
87
88
89
90
91
92
93
94
95
96
<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 class="active">
<a href="student_message.php">For Teacher</a>
</li>
<li><a href="student_message_student.php">For Student</a></li>
</ul>
<form method="post" id="send_message">
<div class="control-group">
<label>To:</label>
<div class="controls">
<select name="teacher_id" class="chzn-select" required>
<option></option>
<?php
$query = mysqli_query($conn,"select * from teacher order by firstname");
while($row = mysqli_fetch_array($query)){
?>
<option value="<?php echo $row['teacher_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-success"><i class="icon-envelope-alt"></i> Send </button>
</div>
</div>
</form>
<script>
jQuery(document).ready(function(){
jQuery("#send_message").submit(function(e){
e.preventDefault();
var formData = jQuery(this).serialize();
$.ajax({
type: "POST",
url: "send_message_student.php",
data: formData,
success: function(html){
$.jGrowl("Message Successfully Sended", { header: 'Message Sent' });
var delay = 2000;
setTimeout(function(){ window.location = 'student_message.php' }, delay);
}
});
return false;
});
});
</script>
</div>
</div>
</div>
<!-- /block -->
</div>
</div>