-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage_comment.php
56 lines (54 loc) · 1.52 KB
/
manage_comment.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
<?php include 'db_connect.php' ?>
<?php
if(isset($_GET['id'])){
$qry = $conn->query("SELECT * FROM comments where id = ".$_GET['id'])->fetch_array();
foreach($qry as $k => $v){
$$k = $v;
}
}
?>
<div class="container-fluid">
<form action="" id="update-comment">
<input type="hidden" name="id" value="<?php echo isset($id) ? $id : '' ?>">
<div class="form-group">
<label for="" class="control-label">Comment</label>
<textarea name="comment" id="" cols="30" rows="4" class="form-control summernote2"><?php echo isset($comment)? $comment: '' ?></textarea>
</div>
</form>
</div>
<script>
$(function () {
$('#update-comment').submit(function(e){
e.preventDefault()
start_load()
// $('#msg').html('')
$.ajax({
url:'ajax.php?action=save_comment',
data: new FormData($(this)[0]),
cache: false,
contentType: false,
processData: false,
method: 'POST',
type: 'POST',
success:function(resp){
if(resp == 1){
alert_toast('Data successfully saved.',"success");
setTimeout(function(){
location.reload()
},1500)
}
}
})
})
$('.summernote2').summernote({
height: 150,
toolbar: [
[ 'style', [ 'style' ] ],
[ 'font', [ 'bold', 'italic', 'strikethrough', 'superscript', 'subscript', 'clear'] ],
[ 'fontsize', [ 'fontsize' ] ],
[ 'para', [ 'ol', 'ul', 'paragraph', 'height' ] ],
[ 'view', [ 'undo', 'redo'] ]
]
})
})
</script>