forked from kalyanm72/Online-Bus-Booking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_route.php
32 lines (28 loc) · 1019 Bytes
/
create_route.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
<?php
header('Access-Control-Allow-Origin: *' );
header('Content-Type:application/json' );
header('Access-Control-Allow-Methods: POST ' );
header('Access-Control-Allow-Headers: Access-Control-Allow-Headers,Content-Type,
Access-Control-Allow-Methods,Autherization,X-Requested-with');
include_once 'Database.php';
include_once 'Post_route.php';
$database=new Database();
$db=$database->connect();
$routes=new Post_route($db);
$data=json_decode(file_get_contents("php://input"));
$routes->bid=$data->bid;
$routes->fromLoc=$data->fromLoc;
$routes->toLoc=$data->toLoc;
$routes->fare=$data->fare;
$routes->dep_date=$data->dep_date;
$routes->dep_time=$data->dep_time;
$routes->arr_date=$data->arr_date;
$routes->arr_time=$data->arr_time;
$routes->avalseats=$data->avalseats;
$routes->maxseats=$data->maxseats;
if($routes->create()){
echo json_encode(array('message'=>'Route added successfully'));
}
else{
echo json_encode(array('message'=>'Route Not added'));
}