-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes.php
127 lines (97 loc) · 2.29 KB
/
notes.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
include "config.php";
$names="";
//write the query to get data from users table
$sql = "SELECT * FROM content";
//execute the query
$result = $conn->query($sql);
session_start();
if (isset($_SESSION['id']) && isset($_SESSION['user_name'])) {
if (isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['user_name']);
header('location: login.php');
}
?>
<?php
include('includes/header.php');
include('includes/navbar.php');
?>
<?php
//index.php
$connect = new PDO("mysql:host=localhost;dbname=nms", "root", "");
$query = "SELECT * FROM tag";
$statement = $connect->prepare($query);
$statement->execute();
$result = $statement->fetchAll();
?>
<html>
<body>
<div class="container-fluid">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">All Notes
</h6>
<br>
<select name="multi_search_filter" id="multi_search_filter">
<option value="disable">Choose category</option>
<?php
foreach($result as $row)
{
echo '<option value="'.$row["id"].'">'.$row["tags"].'</option>';
}
?>
</select>
<input type="hidden" name="hidden_country" id="hidden_country" />
<div style="clear:both"></div>
<br />
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Note Title</th>
<th>Category</th>
<th>Descriptions</th>
<th>action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</body>
</html>
<script>
$(document).ready(function(){
load_data();
function load_data(query='')
{
$.ajax({
url:"fetch2.php",
method:"POST",
data:{query:query},
success:function(data)
{
$('tbody').html(data);
}
})
}
$('#multi_search_filter').change(function(){
$('#hidden_country').val($('#multi_search_filter').val());
var query = $('#hidden_country').val();
load_data(query);
});
});
</script>
<?php
}else{
header('location: login.php');
}
?>
<?php
include('includes/scripts.php');
include('includes/footer.php');
?>