I am learning codeigniter
when i create rule for validate dropdown box but its not given me error message
View File
<?php
$option = array('0' =>'[ Please select an Experience Level ]',
'1' => 'Without experience',
'2' => 'Internship',
'3' => 'Less than one year',
'4' => 'One year',
'5' => 'Two years',);
$shirts_on_sale = array('small','0');
echo form_dropdown('RequiredEducationLevel',$option,'0');
?>
<?php echo form_error('RequiredEducationLevel','<span style="color:red;float:none;">','</span>');?>
Controller File
class Employee_Cont extends CI_Controller {
public function __construct(){
parent::__construct();
$this->load->helper(array('form','url'));
$this->load->helper('html');
$this->load->library('form_validation');
}
public function register()
{
$this->form_validation->set_rules('RequiredEducationLevel','Required Education Level','required|callback_check_default');
$this->form_validation->set_message('check_default', 'You need to select something other than the default');
if($this->form_validation->run() == FALSE)
{
$this->load->view('header/employee_register_header');
$this->load->view('employee_registration');
$this->load->view('footer/employee_footer');
}
function check_default($post_string)
{
return $post_string == '0' ? false : true;
}
}
}
Can you suggestion me what is actual problem.
Thank You