CodeIgniter Forums
Issue? with post data - 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: Issue? with post data (/showthread.php?tid=57941)



Issue? with post data - El Forum - 04-28-2013

[eluser]MRosenello[/eluser]
So, im having an issue with getting post data in a controller. It is working fine if I switch it to get data, but I need to use post though.

I broke it down to a very basic form in order to test it out. Below is the form and the controller/function. I also tried enabling the profiler and that also showed no post data. Thanks in advance for any help.

Code:
<form id="bundleOrderInfo" name="bundleOrderInfo" acti echo(base_url()); ?>catalog/bundleSubmit" method="post">

<input type="text" name ="test" id="test" value="blahblah"></input>
<input type="submit"></input>
</form>

controller:

Code:
public function bundleSubmit()
{
  $this->load->model('catalog_model');
  
  $data['availableCategories']=$this->catalog_model->getCategories();
  $data['availableItems'] = $this->catalog_model->getByCategory($data['availableCategories']);
  $testing = $this->catalog_model->formData(); //seeing if I can get the post data in the model instead.
  
  $this->load->view('templates/header');
  $this->load->view('templates/menu',$data);
  
  print_r($_POST);
  //$values = $this->input->post('overallOptions');
  //echo($values);
  //print_r($this->input->post());

}



Issue? with post data - El Forum - 04-28-2013

[eluser]TheFuzzy0ne[/eluser]
From what you posted, the HTML is invalid. It should be more like:

Code:
<form id="bundleOrderInfo" acti echo base_url('catalog/bundleSubmit'); ?>" method="post">

<input type="text" name ="test" id="test" value="blahblah"></input>
<input type="submit"></input>
</form>

Also your input fields aren't valid markup, either.

I recommend you [url="http://validator.w3.org/"]validate your markup[/url].