[eluser]joeizang[/eluser]
hello everyone,
happy new year first of all. I have a question. I am developing an application using CI 2.10 with the following libraries: ion_auth, phil sturgeons template library. At the moment this is all the libraries I will be using for now. the problem I have is that I created a form and have validation errors sent to a partial as a variable from my controller like so:
Code:
//Controller method processing form
//proper validation happens here.
if($this->form_validation->run() == FALSE)
{
//set dynamic data to be added to the view using the template library style
$data1 = array(
'valid_errors' => validation_errors()
);
$this->template->set_partial('maincontent','partials/student_login')
->build('layouts/default',$data1);
Code:
//this is a snippet from the partial on the view
<p>
<form action="loginstudent" method="POST" id="studentlogin">
<p><label for="Username"><strong>Username :</strong><input name="user_name" id="uname" type="text"/></label></p>
<p><label for="Password"><strong>Password :</strong><input name="password" id="password" type="password"/></label></p>
<p><input name="submitbtn" id="logbtn" type="submit" value="Login"/></p>
</form>
</p>
<?php
echo '<p class="errors"><strong>'.$this->ion_auth->errors().'</strong></p>';
echo '<p class="errors"><strong>'.$valid_errors.'</strong></p>';
?>
but all I get in the regions where I have data from the controller I get this:
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: valid_errors
Filename: partials/student_login.php
Line Number: 15
But when there is an error from trying to login, the errors appear accordingly so where am I missing it?
Thanks for y'all help;-)