[eluser]ChristopherDosin[/eluser]
hey guys
i made a contact form. but i get still no email or an error. did i something wrong?
my contact controller
Code:
<?php
class Contact extends Controller
{
function Contact()
{
parent::Controller();
$this->load->helper('form');
$this->load->helper('email');
$this->load->library('email');
} // function Contact()
function index()
{
if($this->input->post('submit') != "")
{
$name = (string)$this->input->post('name', TRUE);
$email = (string)$this->input->post('email', TRUE);
$subject = (string)$this->input->post('betreff', TRUE);
$message = (string)$this->input->post('nachricht', TRUE);
if(empty($name) OR empty($email) OR empty($subject) OR empty($message))
{
show_error("Bitte füllen Sie alle Felder aus.");
}
if(!valid_email($email))
{
show_error("Bitte überprüfen Sie Ihre Email Adresse");
}
$config['protocol'] = 'sendmail';
$this->email->initialize($config);
$this->email->from($email, $name);
$this->email->to('[email protected]');
$this->email->subject($subject);
$this->email->message($message);
$this->email->send();
$data['main_content'] = 'email-success';
$this->load->view('includes/template', $data);
}
else
{
$data['main_content'] = 'contact_view';
$this->load->view('includes/template', $data);
}
} // function index()
} // class Contact
my contact_view
Code:
<?php echo form_open('contact'); ?>
<label>Name</label>
<input type="text" name="name" />
<label>Email</label>
<input type="text" name="email" />
<label>Betreff</label>
<input type="text" name="betreff" />
<label>Nachricht</label>
<textarea rows="10" cols="60" name="nachricht"></textarea>
<input type="submit" name="submit" value="Email senden" />
</form>