Welcome Guest, Not a member yet? Register   Sign In
Issue? with post data
#1

[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());

}
#2

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




Theme © iAndrew 2016 - Forum software by © MyBB