$this->input->post() always returning FALSE - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: $this->input->post() always returning FALSE (/showthread.php?tid=41716) Pages:
1
2
|
$this->input->post() always returning FALSE - El Forum - 05-15-2011 [eluser]karimmaassen[/eluser] I'm developing a site with a signup form. The problem is that on my localhost (MAMP), everything works fine. But on the public server, every post() is returning FALSE. This is what the code looks like: Code: <fieldset> Code: class Signup extends CI_Controller { Does anyone know what the problem could be? $this->input->post() always returning FALSE - El Forum - 05-15-2011 [eluser]InsiteFX[/eluser] Did you setup your validation rules? Also you need to use the Form_Validation Library! InsiteFX $this->input->post() always returning FALSE - El Forum - 05-15-2011 [eluser]karimmaassen[/eluser] I did. I left them out of the example to simplify. But yes, I did. $this->input->post() always returning FALSE - El Forum - 05-15-2011 [eluser]InsiteFX[/eluser] Well it has to go through this in you Signup Code: if ($this->form_validation->run() == FALSE) InsiteFX $this->input->post() always returning FALSE - El Forum - 05-15-2011 [eluser]Armchair Samurai[/eluser] You need to specify a parameter for post() (i.e. $this->input->post('username')), otherwise you'll need to check $_POST. $this->input->post() always returning FALSE - El Forum - 05-15-2011 [eluser]karimmaassen[/eluser] @InsiteFX: To specify my code a little bit more, this is what I'm doing right now: Code: if ($this->input->post()) The thing is, I'm only seeing 'Not posted'. @Armchair Samurai: I'm fairly sure checking for $this->input->post() is correct. But I also tried $_POST. It doesn't work neither. $this->input->post() always returning FALSE - El Forum - 05-15-2011 [eluser]InsiteFX[/eluser] As Armchair Samurai mentioned above your passing a value to your input! Code: if ($this->input->post('WHAT_VALUE?')) InsiteFX $this->input->post() always returning FALSE - El Forum - 05-15-2011 [eluser]karimmaassen[/eluser] [quote author="InsiteFX" date="1305471432"]As Armchair Samurai mentioned above your passing a value to your input! Code: if ($this->input->post('WHAT_VALUE?')) InsiteFX[/quote] Nope, it doesn't make a difference. I’m fairly sure checking for $this->input->post() is correct. But I also tried $_POST and I tried checking for hidden input, but that doesn't work neither. $this->input->post() always returning FALSE - El Forum - 05-15-2011 [eluser]osci[/eluser] as of user guide $this->input->post() returns all POST items or false if $_POST is not set. I guess it would be ok to use it like this (although i don't see the reason returning a whole array to check if a form is submitted) @Kriem You might be having other issues. Nevertheless I too suggest to use ie the name of your submit button to check if a form is posted like this Code: $this->input->post('submit') and when you post code pls post in code tags Code: [ code ][/ code ] $this->input->post() always returning FALSE - El Forum - 05-15-2011 [eluser]karimmaassen[/eluser] Could this be a trailing slash problem? The form redirects to the correct url, but all post data is lost. I don't know why this works on my localhost, but fails on the public server. |