Welcome Guest, Not a member yet? Register   Sign In
Form Validation
#11

[eluser]parabolic151[/eluser]
the library/email.php is the same as what comes with code igniter. i did not mess with that at all here is the updated code for controler/email.php::
Code:
<?php


/**
* sends Email with Gmail
*/

class Email extends Controller
{
            function __construct(){
                parent::Controller();
                $this->load->library('form_validation');
                
            }
            function index()
            {
            $data['title'] ='CONTACT';
            $this->load->view('contact');
            }
            
            function send()
            {
    
                
                //Field name error message
                $this->form_validation->set_rules('name', 'Name', 'trim|required');
                $this->form_validation->set_rules('message', 'Message', 'required');
                $this->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('[email protected]', $email);
                    $this->email->to('[email protected]');
                    $this->email->subject($subject);
                    $this->email->message($message);
                    
                    $path = $this->config->item('server_root');
                    
                    
                    if($this->email->send())
                    {
                        echo'your message has been sent';
                    }
                    else
                    {
                        show_error($this->email->print_debugger());
                    }
                }
                
                
            }
}

those are the only 2 files the errors pertain to...
#12

[eluser]tomcode[/eluser]
The subject and message are not set.

Edit: ... the variables




Theme © iAndrew 2016 - Forum software by © MyBB