[eluser]Aidy[/eluser]
Hello,
I have put a bit of code together following the guide on form validation. The problem I am having is any form error messages from validation_errors(); are not showing.
Here is the code for the controller.
Code:
class Player extends Controller {
function Player()
{
parent::Controller();
}
function index()
{
$this->load->view('player');
}
function signup()
{
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('first_name', 'First Name', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('player/signup');
}
else
{
$this->load->view('formsuccess');
}
}
}
And here is the code for the view 'player/signup'
Code:
<?php echo validation_errors(); ?>
<?php echo form_open('player/signup'); ?>
<fieldset>
<legend>Personal Details</legend>
<p>
<label for="first_name">First Name</label>
<input type="text" maxlength="30" name="first_name" value="<?php echo set_value('first_name'); ?>"/>
</p>
<p>
<label for="middle_name">Middle Name</label>
<input type="text" maxlength="30" name="middle_name"/>
</p>
<p>
<label for="last_name">Last Name</label>
<input type="text" maxlength="30" name="last_name"/>
</p>
Can anyone point out how I am going wrong?
Cheers!