[eluser]Eric Cope[/eluser]
In your view, I would do this...
Code:
<?php echo $this->validation->error_string; // this echos the error string from validation?>
<?=form_open('blog/do_search');?>
<input type="text" value="<?=$this->validation->fname;?>" name="fname"></input>
<input type="submit" value="search the blog"></input>
</form>
in your controller...
Code:
<?php
$this->validation->set_error_delimiters('<div id="errorLogin">', '</div>');
$rules['fname'] = "trim|required|max_length[100]|xss_clean|..."; / /add more if necessary
$this->validation->set_rules($rules);
$fields['fname'] = "First Name";
$this->validation->set_fields($fields);
if($this->validation->run() == FALSE)
{
$this->load->view('your_search_view');
}
else{
// your data is clean here, so do what you want
$fname = $this->validation->fname; // this is how you access validated data
$this->load->view('search_results_view');
}
?>
This basic structure will allow you to clean your data and then perform the operations as necessary. The user guide outlines this well.
Remember, you can always look at the CI code too. Its not the Windows API!