我有一個簡單接觸形式這就是投擲一個PHP未定義索引錯誤?
「通知:未定義索引:E在\ nas43ent \域\米\ mysite.co.uk \上線路24用戶\ htdocs中\接觸us.php」
錯誤,我似乎無法看到爲什麼,但因爲我的語法看起來正確?
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$to = "[email protected]";
//begin of HTML message
$message = "
From : $name,
Email: $email,
Subject: $subject,
Message: $message ";
//end of message
// To send the HTML mail we need to set the Content-type header.
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: Website Enquiry";
if (isset($_POST['name'])) {
// now lets send the email.
mail($to, $subject, $message, $headers);
header('Location: ' . $_SERVER['HTTP_REFERER'] . '?e=Thankyou, we will be in touch shortly.');
} else {header('Location: ' . $_SERVER['HTTP_REFERER'] . '?e=There was an error sending your message, Please try again.');}
?>
請粘貼實際源,第24行是註釋 – sathia
您確定要使用$ _ SERVER [ 'HTTP_REFERER']? 'e'指的是你在這裏的任何地方都不粘貼的$ _GET ['e']嗎? –