xxxxxxxxxx
// In your controller
public function my_form_submit()
{
// Load the form validation library
$this->load->library('form_validation');
// Set validation rules
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
$this->form_validation->set_rules('password', 'Password', 'required');
if ($this->form_validation->run() == FALSE) {
// Validation failed, show errors
$this->load->view('my_form');
} else {
// Validation passed, proceed with form submission
// Process the form data here
// ...
}
}