codeigniter - can't read $_POST data in PHP 5.6.3 -


in last few month try write small api using php without framework , face dummy bug when try read $_post data, think maybe made dummy mistake in code or localhost have issues because code work fine when upload on server, ignore it, i'm working in project , use codeigniter , use old code , make change in parameter name , etc.

after finish everything, try make test in localhost , again when try read $_post data empty !!. try upload on server , it's work fine !!!

so check php version in server , localhost , found server work php 5.4 , localhost work on 5.6.3 !

is there solution problem ? face same issue?

example:

    function user_signin_post()     {         $this->load->library('form_validation');          //save input in variables         $username = $this->security->xss_clean($this->input->post('username'));         $password = $this->security->xss_clean($this->input->post('password'));         // form_validation fields not empty        $this->form_validation->set_rules('username', 'username', 'required');         if ($this->form_validation->run() == false)        {            $result = array('status' => $this->input->post(),'error_number' => 121,'error_message' => 'dont miss username fild.');            $this->response($result);          }else         {             $this->form_validation->set_rules('password', 'password', 'required');             if ($this->form_validation->run() == false)             {                  $result = array('status' => 0,'error_number' => 122,'error_message' => 'dont miss password fild.');                  $this->response($result);               }else              {                   // load user model                   $this->load->model('users_model');                   $this->load->model('security_model');                   // use signin function                  $query = $this->users_model->user_signin($username, $password);                  $session_key = $this->security_model->create_user_session($query);                  $array = array('user_id' => $query, 'session_key' => $session_key);                  $this->response($array, 200);             }//end 2nd if     }//end 1st if 

i get:

{ "status": [], "error_number": 121, "error_message": "dont miss username fild."  }  

and try print $_post data , it's empty

you should show of code error message.

since using codeigniter frame work, use $this->input->post(); have 2 options: 1- debugging use die(print_r($this->input->post())); show values have been posted. 2- use $this->input->post('post_name'); retrieve single value.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -