Welcome Guest, Not a member yet? Register   Sign In
Redundant or Safer?
#1

[eluser]Jesse Schutt[/eluser]
Hello All,

I am collecting info from a form and posting it to my db using the following code. It occurred to me that the $post_data array that I have created might be redundant. Should I pass the _POST array to the model instead of writing my own $post_data array?

Code:
if ($this->validation->run() == FALSE)
        {
            $this->load->view('wt08/wt08_view');
        }                                
        else
        {
        
        $post_data = array(
            'first_name' => $this->input->post('first_name'),
            'last_name' => $this->input->post('last_name'),
            'gender' => $this->input->post('gender'),
            'address' => $this->input->post('address'),
            'city' => $this->input->post('city'),
            'state' => $this->input->post('state'),
            'zip' => $this->input->post('zip'),
            'camper_email' => $this->input->post('camper_email'),
            'birthdate' => $this->input->post('birthdate'),
            'age_at_time_of_camp' => $this->input->post('age_at_time_of_camp'),
            'first_time_camper' => $this->input->post('first_time_camper'),
            'father_guardian' => $this->input->post('father_guardian'),
            'mother_guardian' => $this->input->post('mother_guardian'),
            'home_phone' => $this->input->post('home_phone'),
            'cell_phone' => $this->input->post('cell_phone'),
            'parent_email' => $this->input->post('parent_email'),
            'church_group' => $this->input->post('church_group'),
            'buddy_1' => $this->input->post('buddy_1'),
            'buddy_2' => $this->input->post('buddy_2'),
            'payment_pref' => $this->input->post('payment_pref'),
            'payment_received' => '0',
            'timestamp' => date("Y-m-d-h-i-s"),
            'additional_notes' => $this->input->post('additional_notes', TRUE)
            );


            $this->load->model('wt08/wt08_model', '', TRUE);
            $this->wt08_model->add_participant($post_data);

In other words, is this better practice? Is it safe?

Code:
if ($this->validation->run() == FALSE)
        {
            $this->load->view('wt08/wt08_view');
        }                                
        else
        {
        
            $this->load->model('wt08/wt08_model', '', TRUE);
            $this->wt08_model->add_participant(_POST);

Thanks in advance!

Jesse


Messages In This Thread
Redundant or Safer? - by El Forum - 10-17-2008, 08:56 AM
Redundant or Safer? - by El Forum - 10-17-2008, 11:13 AM
Redundant or Safer? - by El Forum - 10-17-2008, 11:54 AM
Redundant or Safer? - by El Forum - 10-17-2008, 12:42 PM
Redundant or Safer? - by El Forum - 10-17-2008, 12:45 PM
Redundant or Safer? - by El Forum - 10-17-2008, 01:16 PM
Redundant or Safer? - by El Forum - 10-17-2008, 02:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB