dimanche 27 avril 2014

form submission is not working in php codeigniter


Vote count:

0




HTML:



<form method="post" action="<?php echo site_url("contact")?>">
Full Name :

<input type="text" name="contact_name" class="form-control archo-square-input" required>
<br>Email :
<input type="text" name="contact_mail" class="form-control archo-square-input" required/>
<br>Message :
<textarea class="form-control archo-square-input" name="contact_message" required></textarea>
<br>

<input type="submit" class="btn btn-info archo-square-input" />

</form>


PHP:


Index function of Contact controller



public function index()
{

if (isset($_POST['contact_name'])){



$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";


$name=$_POST["contact_name"];
$mail=$_POST["contact_mail"];
$subject="Contact Messages";
$message = "
<html>
<head>
<title>Email From ".$name."</title>
</head>
<body>
<p>".$_POST["contact_message"]."</p>
<p>Mail :".$mail." </p>
</body>
</html>
";





if(mail($mail,$subject, $message,$headers)){
$data['message']='success';
}else{
$data['message']='error';
}


}else{
$data['message']='';
}

$data['all_albums']=$this->contact_model->get_all_albums();
$this->template->build('contact_view',$data);

}


I know this is a silly problem and I did that kind of work many many time. But God knows why this is not working. Please help. Thanks in advance.



asked 1 min ago

Sujit

152





Aucun commentaire:

Enregistrer un commentaire