Welcome Guest, Not a member yet? Register   Sign In
Using $_POST to submit?
#1

[eluser]Solarpitch[/eluser]
Hey Guys,

I see in the tutorial video's you can submit a the whole post of a form to the database using this simple line.

Code:
$this->db->insert('comments', $_POST);

This doesnt seem to work for me because it's including the value of the submit button and all... and is trying to put that into the query. INSERT INTO...mysubmit...VALUES..('submit');

I have to use this as a work around which seem a little more than what is needed...

Code:
$data = array(
               'account' => $this->input->post('account'),
               'customer_name' => $this->input->post('customer_name'),
               'address1' => $this->input->post('address1'),
               'address2' => $this->input->post('address2'),
               'address3' => $this->input->post('address3'),
               'provence' => $this->input->post('provence'),
               'county' => $this->input->post('county'),
               'country' => $this->input->post('country'),
               'email' => $this->input->post('email'),
               'telephone' => $this->input->post('telephone'),
               'mobile' => $this->input->post('mobile'),
               'fax' => $this->input->post('fax'),
               'website' => $this->input->post('website'),
               'description' => $this->input->post('website'),

               );
              
        $this->report_model->insert_client($data);

Is there something I'm missing with this? The one line using the $_POST seems alot easier and less code. Why is it including the value of the submit button also?


Messages In This Thread
Using $_POST to submit? - by El Forum - 02-11-2009, 10:29 AM
Using $_POST to submit? - by El Forum - 02-11-2009, 10:48 AM
Using $_POST to submit? - by El Forum - 02-11-2009, 10:57 AM
Using $_POST to submit? - by El Forum - 02-11-2009, 02:20 PM
Using $_POST to submit? - by El Forum - 02-11-2009, 03:12 PM
Using $_POST to submit? - by El Forum - 02-11-2009, 03:34 PM
Using $_POST to submit? - by El Forum - 02-11-2009, 05:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB