[solved] POST datas not found - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: [solved] POST datas not found (/showthread.php?tid=65111) |
[solved] POST datas not found - gaska96 - 04-30-2016 Hi. I created a view file with a form and I want to send all datas to a controller. I use $this->input->post('NAME', TRUE) to get each data then I check each to see if they are empty. And... all are empty. Why controller don't receive data ? I hope it's a good question. (Have mercy ! ) RE: POST datas not found - InsiteFX - 04-30-2016 You need to set the form to post to the controller/method. RE: POST datas not found - gaska96 - 05-01-2016 I did that. I thought is something with $config['uri_protocol'] ? Or it's something with routes ? (beucase I set my route like $route['addServer'] = 'home/addServer'; ) RE: POST datas not found - InsiteFX - 05-01-2016 And what does your html form look like please show your code for the form and controller method for us to help you. RE: POST datas not found - gaska96 - 05-01-2016 Controller: PHP Code: public function addserver(){ Form: Code: <form role="form" action="addserver" method="POST"> RE: POST datas not found - Wouter60 - 05-01-2016 Did you test whether submitting the form calls the addserver method in your controller? Usually, in the form declaration you need to include controller AND method, like this: PHP Code: <form role="form" action="servers/addserver" method="POST"> Put the following code at the top of the addserver method: PHP Code: echo '<pre>'; RE: POST datas not found - gaska96 - 05-01-2016 When I do this, I get that array... I don't know what could be wrong. I did this before 2-3 times and works fine. Maybe reinstall Codeigniter ? RE: POST datas not found - Wouter60 - 05-01-2016 If you get the POST array (with values), nothing is wrong, and you are good to go. Now you can save the data into a table in your database. RE: POST datas not found - gaska96 - 05-02-2016 I know I know. But my problem is really strange. If I print only $game for example (check before posts), it prints good , but if I make : if($game == 0){ $error = "ERROR"; } my site returns that error even if $game is CS (for example). What is wrong with this ? EDIT: Solved. There was an error with session, because I wrote sesion and I compared integer with string. (I'm dumb) |