[eluser]Unknown[/eluser]
[quote author="sarram" date="1252089323"]
Code:
<?php
class Welcomenote extends Controller {
function index()
{
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('firstname', 'Firstname', 'trim|required');
$this->form_validation->set_rules('lastname', 'Lastname', 'trim|required');
$this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[12]|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'trim|required|matches[confirm_password]|md5');
$this->form_validation->set_rules('confirm_password', 'Password Confirmation', 'trim|required');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
$this->form_validation->set_rules('phonenumber', 'Phone Number', 'trim|required|numeric');
?>
[/quote]
Code:
class Welcomenote extends Controller {
function index()
{
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('firstname', 'Firstname', 'trim|required');
$this->form_validation->set_rules('lastname', 'Lastname', 'trim|required');
$this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[12]|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'trim|required|matches[confirm_password]|md5');
$this->form_validation->set_rules('confirm_password', 'Password Confirmation', 'trim|required');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
$this->form_validation->set_rules('phonenumber', 'Phone Number', 'trim|required|numeric');
$this->form_validation->set_rules($config_validation);
if ($this->form_validation->run()){
$dtInsert = array(
'firstname' => $this->input->post('firstname'),
'lastname' => $this->input->post('lastname'),
'username' => $this->input->post('username'),
'password' => $this->input->post('password'),
'confirm_password' => $this->input->post('confirm_password'),
'email' => $this->input->post('email'),
'phonenumber' => $this->input->post('phonenumber'),
);
if($this->model_name->add($dtInsert)){
// your input success message or redirect
}
}
}
}