[eluser]Unknown[/eluser]
can anyone pls tell me wat is the pbm in the code for inserting a row.
my controller :
<?php
class Form extends Controller{
function Form(){
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
$this->load->model(');
}
function index(){
$this->load->view('form_view.php');
/* $dta['name']=$this->input->post('name');
$dta['mail']=$this->input->post('email');
$dta['add']=$this->input->post('text');
$dta['ph']=$this->input->post(');
$this->form_model->insert($dta);*/
}
function insert_data()
{
$dta['name']=$this->input->post('name');
$dta['mail']=$this->input->post('email');
$dta['add']=$this->input->post('text');
$dta['ph']=$this->input->post(');
//print("<pre>");print_r($dta);die();
$this->form_model->insert($dta);
}
}
?>
my model
<?php
class Form_model extends Model
{
function Form_model()
{
parent::Model();
}
function insert($data)
{
//print("<pre>");print_r($data);die();
$data=Array('name' =>$data['name'],
'Email Id' => $data['mail'],
'address' => $data['add'],
'pn numb:'=> $data['ph']);
//print("<pre>");print_r($data);die();
$this->db->insert('abc', $data);
}
}
?>
my view:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Godbit Code Igniter Tutorial: Creating a simple Registration Form</title>
<style type="text/css">
body {
font: small/1.5em Verdana, Arial, Helvetica, serif;
}
</style>
</head>
<body>
<form action="form/insert_data" method="post">
<h1>Registration Form</h1>
<p>Please complete the following form:</p>
<table>
<tr><td>Name</td><td><input type="text" name="name" /></td></tr><br/>
<tr><td>Email id</td><td><input type="text" name="email" /></td></tr>
<tr><td>Address</td><td><textarea name="text" rows="10" cols="5"></textarea></td></tr>
<tr><td>Ph no:</td><td><input type="text" name="phnum"/></td></tr>
<tr><td><input type="submit" value="Submit"/></td></tr>
</table>
</form>
</body>
</html>
error occuring is like this:
Fatal error: Call to a member function insert() on a non-object in C:\xampp\htdocs\CodeIgniter_1.7.3\system\application\models\form_model.php on line 16
pls help me I'm new in codeigniter and php.