Welcome Guest, Not a member yet? Register   Sign In
Problem loading Validation Class
#1

[eluser]Unknown[/eluser]
Hello, I am having issues loading codeigniters validation class. I first tried using the library inside of one of my own controllers and had no success so I tried to use the example in the user's guide and still have no luck. I then tried to autoload the class but that did not work. As a last resort, I tried to restart my HTTP server thinking the pages were not updating and it still fails. I am using PHP 5 + Apache 2.2. Below is an example along with the error that I am receiving. Thank you all in advance

/* User Guide Example */

class Form extends Controller {

function index()
{
$this->load->helper(array('form', 'url'));

$this->load->library('validation');

$rules['username'] = "required";
$rules['password'] = "required";
$rules['passconf'] = "required";
$rules['email'] = "required";

$this->validation->set_rules($rules);

if ($this->validation->run() == FALSE)
{
$this->load->view('myform');
}
else
{
$this->load->view('formsuccess');
}
}
}

/* End user guide example */

/* error message when loading the view. Error is from the form.php class so the view is not even loading yet because of errors* /


Severity: Notice

Message: Undefined property: Form::$validation

Filename: controllers/form.php

Line Number: 16

Call to a member function set_rules() on a non-object in form.php
#2

[eluser]Unknown[/eluser]
Nevermind, I just read that only php 4 is supported that explains why this is not working. Thank you.




Theme © iAndrew 2016 - Forum software by © MyBB