Articles → PHP CODEIGNITER → Insert Method In The Active Records In Codeigniter
Insert Method In The Active Records In Codeigniter
Table
Click to Enlarge
User Interface
Click to Enlarge
Code To Insert Data In The Table
if(!empty($_REQUEST))
{
$agent = array(
"agent_name" => $this->input->post("agentname"),
"contact_number" => $this->input->post("contactnumber"),
"email_id"=> $this->input->post("emailid"),
"state"=> $this->input->post("state"),
"city"=> $this->input->post("city"),
"agent_address"=> $this->input->post("address"),
"pin_code"=> $this->input->post("pin")
);
$this->load->model('AgentModel');
$this->AgentModel->InsertAgent($agent);
}
public function InsertAgent($agent)
{
$this->load->database();
$this->db->insert("Agents", $agent);
}
Output
Click to Enlarge