/
ajaxhandler.php
54 lines (44 loc) · 1.34 KB
/
ajaxhandler.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
<?php
include 'config.php';
require_once 'dbconnect.php';
if($_SERVER['REQUEST_METHOD'] == "GET"){
$type = $_GET['type'];
switch(strtolower($type)){
case 'modal': modalHandler($_GET['value']);
break;
case 'application': applicationHandler($_GET['value']);
break;
case 'category': categoryHandler();
break;
case 'categorydd': categoryXSHandler();
}
}
else if($_SERVER['REQUEST_METHOD'] == "POST"){
$ptype = $_POST['ptype'];
switch ($ptype){
case 'empfeed': echo addEmp(); break;
}
}
function modalHandler($appID){
editModal($appID);
}
function modalHandler2($appID){
editlns($appID);
}
function applicationHandler($category){
createAppCollection($category);
}
function categoryHandler(){
createCategoryButtons();
}
function categoryXSHandler(){
createCategoryDropdown();
}
function addEmp(){
$conn = getConnection();
$sql = "INSERT INTO `employees` (name, type, branch)
VALUES ('" . $_POST['name'] . "', '" . $_POST['type'] . "', '" . $_POST['br'] . "')";
$ret = $conn->query($sql);
$conn->close();
return $ret;
}