Hey, I am having an issue with validating my form, for some reason the form_validation library is not loading…
this is my Email Controller:
<?php
class Email extends Controller
{
function __construct(){
parent::Controller();
}
function index()
{
$this->load->view('contact');
$this->load->library('form_validation');
}
function send()
{
//Field name error message
$this->load->form_validation->set_rules('name', 'Name', 'trim|required');
$this->load->form_validation->set_rules('message', 'Message', 'required');
$this->load->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');
if($this->form_validation->run()==FALSE)
{
$this->load->view('contact');
}
else
{
//validation has passed
$name= $this->input->post('name');
$email= $this->input->post('email');
$this->load->library('email');
$this->email->set_newline("\r\n");
$this->email->from('parabolic151@gmail.com', $email);
$this->email->to('pjahk@pdbmedia.com');
$this->email->subject($subject);
$this->email->message($message);
$path = $this->config->item('server_root');
if($this->email->send())
{
echo'your message has been sent yoooo!';
}
else
{
show_error($this->email->print_debugger());
}
}
}
}
This is the error message that comes up when i try to use the form..
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Loader::$form_validation
Filename: controllers/email.php
Line Number: 24
if you want to see MY SITE it is the contact section I am having issues with…
