I'm doing maintenance on a website that another developer created. The client was having some data display issues and I narrowed it down to their input form, or more specifically, the POST data processing. All the fields are TEXTAREA fields and the controller function looks like this:
85 $data=array(
86 'f_location'=>$this->input->post('flocation'),
87 's_location'=>$this->input->post('slocation'),
88 't_location'=>$this->input->post('tlocation'),
89 'forthlocation'=>$this->input->post('forthlocation'),
90 'fifthlocation'=>$this->input->post('fifthlocation'),
91 'sixthlocation'=>$this->input->post('sixthlocation')
92 );
93 $query=$this->admin_model->updatelocation($data);
The updatelocation function in the model is:
54 function updatelocation($data){
55 $query=$this->db->where('id','1');
56 $query=$this->db->update('location',$data);
57
58 if($query){
59 return true;
60 }else{
61 return false;
62 }
63 }
For whatever reason, whenever I submit any sort of text data through the form, it stores it in the database as a '0'. When I submit integers, it stores the integers directly. To make matters weirder, I just tried to do a print_r($_POST) inside the controller function and if there is any integers, all data is accepted, including text. If all of the fields are text, the $_POST array is empty.
I am not a pro on CodeIgniter by any means, but I can at least work my way around it, and I can't figure this one out.
Here's the list of what I've checked so far:
- XSS Filtering is off
- Form Validation is not being used
- Database collation/character set doesn't affect it (currently utf8_unicode_ci)
- Database data type is set to text
- Tried adding trailing / to form action
- db_debug is enabled in config/database.php (no errors reported)
I'm sure there's a few other things I've tried that I can't think of right now. Oh, and one other weird thing. I have a local development server in my house. When I download the entire codebase to that server, everything works fine. Literally the only change I make is the baseurl in the config so it works locally for me, and then everything works just fine: text, integers, everything. It's only on the remote hosted site that the text won't go through. Any help is appreciated. I'm thoroughly stumped.
Aucun commentaire:
Enregistrer un commentaire