[eluser]Sean Delaney[/eluser]
Here is my view add.php file that contains a form:
Code:
<?php
$form_attributes = array('class' => 'add','id' => 'add');
$author_attributes = array(
'name' => 'author',
'id' => 'author',
'value' => '',
'placeholder' => 'Joe Bloggs',
'title' => 'Author'
);
$author_email_attributes = array(
'name' => 'author_email',
'id' => 'author_email',
'value' => '',
'placeholder' => '[email protected]',
'title' => 'Author Email'
);
echo form_open('add',$form_attributes);
echo form_label('Name:','author');
echo form_input($author_attributes,set_value('author'));
echo form_label('Email:','author_email');
echo form_input($author_email_attributes,set_value('author_email'));
echo form_submit('add','Submit');
echo form_close();
?>
In my controller I have set:
Code:
$this->load->library(array('form_validation'));
$this->load->helper(array('form','security'));
$this->form_validation->set_rules('author','Name','required|trim|xss_clean');
$this->form_validation->set_rules('author_email','Email','required|valid_email|trim|xss_clean');
$this->form_validation->set_error_delimiters('<li>','</li>');
If there is a field not filled in after I submit the form, the get the error messages but set_value is empty?
Any reason?