forked from TomZ79/jquery-tabledit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.php
44 lines (26 loc) · 825 Bytes
/
example.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
<?php
// Basic example of PHP script to handle with jQuery-Tabledit plug-in.
// Note that is just an example. Should take precautions such as filtering the input data.
header('Content-Type: application/json');
// CHECK REQUEST METHOD
if ($_SERVER['REQUEST_METHOD']=='POST') {
$input = filter_input_array(INPUT_POST);
} else {
$input = filter_input_array(INPUT_GET);
}
// PHP QUESTION TO MYSQL DB
// Connect to DB
/* Your code for new connection to DB*/
// Php question
if ($input['action'] === 'edit') {
// PHP code for edit action
} else if ($input['action'] === 'delete') {
// PHP code for edit delete
} else if ($input['action'] === 'restore') {
// PHP code for edit restore
}
// Close connection to DB
/* Your code for close connection to DB*/
// RETURN OUTPUT
echo json_encode($input);
?>