samedi 8 décembre 2018

PHP error: "Notice: Undefined variable: send_contact ... on line 20."

My code:

<?php

if( isset($_POST["submit"]) ) { 
// Contact subject
$name =$_POST["name"]; 
// Details
$message=$_POST["message"];
// Mail of sender
$mail_from=$_POST["email"]; 
// From 
$header="from: $name <$mail_from>";

// Enter your email address
$to ='info.lightuptrading@gmail.com';

$send_contact=mail($to,$name,$message,$header);
}
// Check, if message sent to your email 
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
} 
?>

I have defined the variable send_contact. Why does it say undefined if it is defined?

Does anyone know a solution?




Aucun commentaire:

Enregistrer un commentaire