Welcome Guest, Not a member yet? Register   Sign In
Validation Errors not showing
#1

[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>
  &lt;input type="text" maxlength="30" name="first_name" value="&lt;?php echo set_value('first_name'); ?&gt;"/&gt;
</p>

<p>
  <label for="middle_name">Middle Name</label>
  &lt;input type="text" maxlength="30" name="middle_name"/&gt;
</p>

<p>
  <label for="last_name">Last Name</label>
  &lt;input type="text" maxlength="30" name="last_name"/&gt;
</p>

Can anyone point out how I am going wrong?

Cheers!
#2

[eluser]Aidy[/eluser]
I have solved my problem. I have been working on a live server. And somewhere along the line I have deleted the controller then created it again but renamed with a capital letter by mistake. I uploaded the file thinking it would overwrite. I'm sure you can work out the rest!!

Very sorry if I have wasted anyones time :red:




Theme © iAndrew 2016 - Forum software by © MyBB