Welcome Guest, Not a member yet? Register   Sign In
Undefined property: News::$form_validation
#1

[eluser]rm_beginner[/eluser]
Hi All,

Pls help i am new in this php coding. When i follow the tutorial
I received this error message:


"A PHP Error was encountered

Severity: Notice

Message: Undefined property: News::$form_validation

Filename: controllers/news.php

Line Number: 45

Fatal error: Call to a member function set_rules() on a non-object in .../application/controllers/news.php on line 45"


line 45: $this->form_validation->set_rules('title', 'Title', 'required');


Thanks.
#2

[eluser]alexwenzel[/eluser]
You forgot to load the form validation library. Load it either with autoload.php or with CI loader class.
#3

[eluser]rm_beginner[/eluser]
Hi,

Thanks for the reply.

can you try this tutorial?
here's the link: http://ellislab.com/codeigniter/user-gui...ation.html

it was loaded here...

Code:
<?php

class Form extends CI_Controller {

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

  $this->load->library('form_validation'); //<---------loaded.

  if ($this->form_validation->run() == FALSE) //<---the error is here.
  {
   $this->load->view('myform');
  }
  else
  {
   $this->load->view('formsuccess');
  }
}
}
?&gt;


Fatal error: Call to a member function run() on a non-object in ../application/controllers/form.php on line 11



Thank you.
#4

[eluser]CroNiX[/eluser]
Maybe you need to set some validation rules first before you run it.
#5

[eluser]rm_beginner[/eluser]
I solved it again..Smile

just put in autoload.php and remove the load command in form controller.

thanks




Theme © iAndrew 2016 - Forum software by © MyBB