[eluser]Zeeshan Rasool[/eluser]
Hi i have my validation code here, Hope you get some help.
This my view... not full code..
Code:
<td class="td_padding_heading">User Name<span class="Red">*</span></td>
<td class="input_margin">
$data = array(
'name' => 'username',
'id' => 'username',
'value' =>
'maxlength' => '200',
'size' => '55',
//'style' => 'width:80%',
);
echo form_input($data);?>
</td>
</tr>
This is controller part.
Code:
$rules['username'] = "required|alpha_numeric|alpha_dash|min_length[6]|max_length[20]";
$rules['fullname'] = "required";
$rules['slogan'] = "required";
$this->validation->set_rules($rules);
$fields['username'] = 'User Name';
$fields['fullname'] = 'Full Name';
$fields['slogan'] = 'Slogan';
$fields['email'] = 'Email';
$fields['phone'] = 'Phone';
$this->validation->set_fields($fields);
if ($this->validation->run() == FALSE)
{
$newdata = array('Flag' => 'Form Validation Error! Please try again!');
$this->session->set_userdata($newdata);
}
else
{
///your next func part here....