Welcome Guest, Not a member yet? Register   Sign In
why am I not getting $this->input->post?
#1

[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.

#2

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

??
#3

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




Theme © iAndrew 2016 - Forum software by © MyBB