I was just making a simple room reservation system for my hotel using Codeigniter as framework. In my localhost the controller and its methods are working as expected, but when I upload the files to a testing server of mine, one of my controller became unaccessible. Neither it shows loaded view pages nor error. I've tried with url like www.mydomain.com/testing/index.php/room_booking and www.mydomain.com/testing/index.php/room_booking/post_action too but nothing is shown and then I've tried using die ('my code is not executed'), but it didn't print die either. So it made me go crazy and I elapsed my whole day.
My Controller is as:
header("Access-Control-Allow-Origin: *");
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class room_booking extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->library('session');
$this->load->model('dbmodel');
$this->load->model('api_model');
$this->load->model('dashboard_model');
$this->load->model('booking_room');
$this->load->helper('url');
$this->load->helper(array('form', 'url'));
$this->load->library("pagination");
}
public function index() {
$this->load->view('template/header');
$this->load->view('template/imageDiv');
$this->load->view('template/reservation_template');
//$this->load->view('login/test');
$this->load->view('template/footer');
}
function post_action() {
$this->load->helper('availableroom');
die('here i used die function for test');
if ($_POST) {
$data['abc'] = array(
'checkin' => $_POST['checkin'],
'checkout' => $_POST['checkout'],
'adult' => $_POST['adult'],
'child' => $_POST['child'],
'hotelId' => $_POST['hotelId'],
'title' => $_POST['title']
);
$this->session->set_userdata($data['abc']);
$hotel = $_POST['hotelId']; // form top it got hotel name
$hotels = $this->dashboard_model->get_hotel_id($hotel);
if (!empty($hotels)) {
foreach ($hotels as $hotelData) {
$hotelId = $hotelData->id;
}
} else {
$hotelId = $_POST['hotelId'];
}
$data['query'] = $this->dashboard_model->booking_room($hotelId);
$data['json'] = json_encode($data['query']);
$this->load->view('ReservationInformation/room_booking', $data);
} else {
$this->load->view('ReservationInformation/room_booking_empty_view');
}
}
}
Am I doing any mistake here? In post_action method I passed a value from ajax call. How can I have it solved in server?