PHP错误:“注意:未定义的变量:第20行上的send_contact ...”

时间:2018-12-08 15:57:02

标签: php html web

我的代码:

<?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";
} 
?>

我已经定义了变量send_contact。为什么会说未定义,如果未定义?

有人知道解决方案吗?

0 个答案:

没有答案