function book_a_seat()
{
    $result = -100;
    if (isset($_REQUEST['event_id']) && isset($_REQUEST['seat_id']) && isset($_REQUEST['booking_id'])) {
        $event_id = $_REQUEST['event_id'];
        $seat_id = $_REQUEST['seat_id'];
        $booking_id = $_REQUEST['booking_id'];
        seating_chart::release_a_seat($booking_id);
        $check = seating_chart::check_seat_available($event_id, $seat_id);
        if ($check == 0) {
            $booking_id = seating_chart::book_a_seat($event_id, $seat_id);
            $result = $booking_id;
        } else {
            $result = -1;
        }
    }
    echo $result;
}