[eluser]ann91[/eluser]
Hii...
I have a problem with this code..
this model
Code:
<?php
class FormModel extends CI_Model{
function __construct(){
parent::__construct();
}
function insert(){
$data = array(
"username" => $this->input->post('username'),
"password" => $this->input->post('password'),
"confpass" => $this->input->post('confpass'),
"email" => $this->input->post('email')
);
$this->db->insert('cust',$data);
}
}
?>
and this Controller
Code:
<?php
class Form extends CI_Controller{
function index(){
$this->load->helper(array('form','url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('username','Username','required|min_length[3]|max_length[5]');
$this->form_validation->set_rules('password','Password','required|matches[confpass]');
$this->form_validation->set_rules('confpass','Confirm Password','required');
$this->form_validation->set_rules('email','Email','required|valid_email');
if($this->form_validation->run()){
if ($this->FormModel->insert($data))
{
$this->load->view('formSuccess');
}
else{
$this->load->view('Myform');
}
}
else{
$this->load->view('Myform');
}
}
}
?>
I think this is a wrong controller code and i don't know, can you fix it..
Thanks before.. :lol: