CodeIgniter Forums
why am I not getting $this->input->post? - 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: why am I not getting $this->input->post? (/showthread.php?tid=53075)



why am I not getting $this->input->post? - El Forum - 07-10-2012

[eluser]obiron2[/eluser]
Hi guys this is driving me mad.

View code
Code:
<? echo form_open('/zzz');?>
<? echo form_input('testtext');?>
<? echo form_submit('submit','send');?>
<? echo form_close();?>

generates the following html
Code:
<form action="//localhost/ci/index.php/zzz" method="post" accept-charset="utf-8">
<input type="text" name="testtext" value=""  />
<input type="submit" name="submit" value="send"  />
</form>

Controller zzz
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class zzz extends CI_controller
{

function index()
{

  if (isset($this->input->post['testtext']))
  {
   echo $this->input->post['testtext'];
  }
  else
  {

   echo "no post value";
  }

}
}

config file has base_url set to "//localhost/ci/"
Index file set to "index.php"

The controller is being called but not passing the isset test and just gives me the no post value. I can't see what I am doing wrong.




why am I not getting $this->input->post? - El Forum - 07-10-2012

[eluser]obiron2[/eluser]
update:
$_POST is being populated, but it is not being converted into $this->input->post

??



why am I not getting $this->input->post? - El Forum - 07-10-2012

[eluser]Alhazred[/eluser]
You are using square brackets, you have to use round ones
$this->input->post('testtext')