-
Notifications
You must be signed in to change notification settings - Fork 3
/
leave.php
27 lines (22 loc) · 875 Bytes
/
leave.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
<?php
$connect = mysqli_connect("localhost", "root", "", "vocational training institute");
$data=json_decode(file_get_contents("php://input"));
if(count($data) > 0)
{
$uname = mysqli_real_escape_string($connect, $data->uname);
$type = mysqli_real_escape_string($connect, $data->type);
$num_day = mysqli_real_escape_string($connect, $data->num_day);
$from_date = mysqli_real_escape_string($connect, $data->from_date);
$to_date = mysqli_real_escape_string($connect, $data->to_date);
$comment = mysqli_real_escape_string($connect, $data->comment);
$query = "INSERT INTO leave_table(uname, type, num_day, from_date, to_date, comment) VALUES ('$uname' , '$type', '$num_day', '$from_date', '$to_date', '$comment' )";
if(mysqli_query($connect, $query))
{
echo "DATA INSERTED...";
}
else
{
echo 'ERROR';
}
}
?>