I am getting data from view using post method ie., in $data variable and I need pass this i.e, $data to model I have tried like below but it is showing like A PHP
Error was encountered Severity: Notice Message: Undefined property: Post::$data Filename: core/Model.php Line Number: 77
Below is mycode:
Array
(
[name] => Mohan
[email] => mohan@gmail.com
[phone] => 9739764966
[location] => TEST
[website] => 192.168.1.156
[useragent] => Chrome
[ipaddress] => 192.168.1.23
[desc] => Bengaluru
[captcha] => 20701449
[captcha_word] => 20701449
[submit] => Submit
)
controller:
public function postEnquiry()
{
$data = $this->input->post();
// echo "<pre>";print_r($data);die;
$this->load->model('Enquiry');
$result = $this->Enquiry->sendenquiry($data);
if($result){
$this->session->set_flashdata('success','Sent Successfully');
redirect(ROOT_PATH."/form");
}
}
Model:
<?php
class Enquiry extends CI_Model {
public function __construct()
{
parent::__construct();
$this->load->database();
}
public function sendenquiry($data)
{
print_r($data);die;
}
}
?>