I don’t think, this is your full code, but what I can see you have never set $_POST['sendemail']
so if(isset($_POST['sendemail'])) {
will never be true.
EDIT
Just see the code below, I made 3 comments.
<?php
// 1. -------------↓ Change sendemail to submit
if(isset($_POST['submit'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "[email protected]";
$email_subject = "General Inquery";
$name = $_POST['name'];
$email = $_POST['email'];
$subject =$_POST['subject'];
$message = $_POST['message'];
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
// 2. --↓ Add $email_message="";
$email_message="";
$email_message .= "First Name: ".clean_string($name)."\n";
// 3. -------------------------------------↓ Change $email_from to $email
$email_message .= "Email: ".clean_string($email)."\n";
$email_message .= "subject: ".clean_string($subject)."\n";
$email_message .= "message: ".clean_string($message)."\n";
echo "message: " . $email_message . "<br>";
}
?>
6
solved send email is not working with bootstrap [duplicate]