Welcome Guest, Not a member yet? Register   Sign In
Newbie trying to get form data into database
#7

[eluser]CroNiX[/eluser]
[quote author="xerobytez" date="1360116196"]You got the idea but

Code:
$first_name ->$this->input->post('first_name');

should be

Code:
$first_name = $this->input->post('first_name');

Note the equal right after the variable name. In the particular example I posted you shouldn't need any additional libraries or helpers. You can pull all form fields into an array with the method below from the input class.

Code:
$form_data = $this->input->post();

//You can then do

$this->employee_model->insert_employee(
    $form_data['first_name'],
    $form_data['last_name'],
    $form_data['email']
);
[/quote]
That is very insecure to just insert the entire post array with no validation or checking of allowed fields. It's not hard to manipulate forms within the browser and add your own fields to submit...


Messages In This Thread
Newbie trying to get form data into database - by El Forum - 02-05-2013, 12:22 PM
Newbie trying to get form data into database - by El Forum - 02-05-2013, 04:58 PM
Newbie trying to get form data into database - by El Forum - 02-05-2013, 06:34 PM
Newbie trying to get form data into database - by El Forum - 02-05-2013, 07:03 PM
Newbie trying to get form data into database - by El Forum - 02-05-2013, 07:39 PM
Newbie trying to get form data into database - by El Forum - 02-07-2013, 06:53 AM
Newbie trying to get form data into database - by El Forum - 02-07-2013, 11:21 AM
Newbie trying to get form data into database - by El Forum - 02-07-2013, 11:26 AM
Newbie trying to get form data into database - by El Forum - 02-07-2013, 01:39 PM
Newbie trying to get form data into database - by El Forum - 02-07-2013, 01:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB