[eluser]Unknown[/eluser]
Sorry guys,
This might be a silly question... still new to MVC framework and CI. Hope you understand.
I have a controller called create_account and a model called membership_model. In the controller I have a function that loaded the model and adds data to the database from the view.
My problem: I have an array of data that I need to pass to the model so it can be stuffed into the database. I have no problem with adding the post data from the form. How do I add the arrayed data from the controller and pass it to the model for db insertion? Thanks for any help on this one.
Here is the controller snippet: The $httpParsedResponseAr is the arrayed data that needs passed to the database and it does have data.
Code:
<?php
$httpParsedResponseAr = $this->paypal->PPHttpPost($methodToCall, $nvpStr);
$ack = strtoupper($httpParsedResponseAr["ACK"]);
if($ack!="SUCCESS") {
$data['responce'] = $httpParsedResponseAr;
// Add member to database using -> application/model/membership_model.php create_member() function
$this->load->model('membership_model');
$this->membership_model->create_member();
$data['main_content'] = 'site/step3_fail_view';
$this->load->view('site_template/template', $data);
}
?>
And the Model that has the arrayed var $responce['PROFILEID'].
Code:
<?php
function create_member() {
$new_member_insert_data = array(
'pp_profileID' => $responce['PROFILEID'],
'first_name' => $this->input->post('first_name'),
'last_name' => $this->input->post('last_name'),
'email_address' => $this->input->post('email'),
'password' => $this->encode5t($this->input->post('password'))
);
$insert = $this->db->insert('membership', $new_member_insert_data);
return $insert;
}
?>