[eluser]rhand_ci[/eluser]
With the following code data is stored in my table and sent to the designated email address:
Code:
<?php
class Rentalform extends Controller {
// Extend controller with new one
function Rentalform()
{
parent::Controller();
$this->load->helper(array('form', 'url')); // load two helpers
$this->load->library('form_validation'); // load form validation from the library
$this->load->library('email');
}
function index()
{
$data['title'] = "Rental Form";
$data['heading'] = "Rental Form Heading";
$this->load->view('rentalform_view', $data);
}
function insert_rentalform()
{
$this->db->insert('rentalform', $_POST);
//redirect('rentalform');
$message = $this->input->post('company_name');
$this->load->library('email');
$config['protocol'] = 'sendmail';
$this->email->initialize($config);
$this->email->from('[email protected]', 'Test address');
$this->email->to('me@localhost');
$this->email->subject('Email Test');
$this->email->message($message);
$this->email->send();
echo $this->email->print_debugger();
}
}
Just what I needed :-) Now I just need to work on adding more field data to the body in a nice way, validate the form data and improving the controller.