Welcome Guest, Not a member yet? Register   Sign In
How to update ALOT of fields from a form
#1

[eluser]trope[/eluser]
Being fairly new to CI, I am wondering if there is a better way to update a table from a form, other than the way I have below.

My entire form corresponds with the field names in the table.

Thanks!

Code:
$update_data = array();
    
    $update_data[""] = $this->input->post("field1");
    $update_data[""] = $this->input->post("field2");
    $update_data[""] = $this->input->post("...");
    $update_data[""] = $this->input->post("...");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    $update_data[""] = $this->input->post("");
    
      $this->user_model->update($update_data);




Theme © iAndrew 2016 - Forum software by © MyBB