I have this code in my view:
echo form_label('State', 'state');
$options = array(
'No state' => '- Select state -',
'Alabama' => 'Alabama',
'Florida' => 'Florida',
'California' => 'California',
);
echo form_dropdown('state', $options);
echo form_error('state', '<div class="error">', '</div>');
And in my controller this:
$this->form_validation->set_rules('state', 'State', 'required|regex_match[??????]');
if ($this->form_validation->run() == FALSE)
{
// VALIDATION ERROR
$this->load->view('page_registration');
}
else
{
// VALIDATION SUCCESS
....
....
....
My question is what to type inside regex_match instead of the question marks, so when everythng else instead of No state is selected it will succed. If you select No state, then the registration page reload and shows the error.
I need the regular expression code between the square brackets for regex_match.
Thanks in advance.