我对简单的联系箱有疑问。我想将信息从表单发送到我的电子邮件。
已经尝试打开和关闭注册全局变量(.httacess),尝试使用简单的 $formname 和 $_POST['formname'] 但仍然收到没有表单信息的电子邮件。
<?php
if ($action == "send"){//isset wyslij
//if (!$name || !$email || !$phone || !$enquiry) {
//$problem = TRUE;
//echo("<p>You have to fill all form.</p>");
//}
if (!$problem){
$name = $_POST['name'];
$data = date("d.m.y");
$message = "
<p>Name: $name</p>
<p>Phone: $phone</p>
<p>Email: $email</p>
<br>
<p>Enquiry: $enquiry</p>";
$od = "blabla@email.com";
$content = $message;
$header = "From: $od \r\n";
$header .= 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
(mail('myemail@gmail.com', 'New message from website Angelzena', $content, $header));
echo("<br><p>Message has been sent.</p>");
}else{
echo("<p>Try <a href=contact.php>again</a></p>");
}
}
?>
<form action="contact.php?action=send" method="post" enctype="text/plain">
<label for="name">Name</label><input type="text" name="name" /></br></br>
<label for="email">Email</label><input type="text" name="email" /></br></br>
<label for="phone">Phone</label><input type="text" name="phone" /></br></br>
<label for="enquiry">Enquiry</label><textarea name="enquiry" cols="20" rows="10"></textarea></br></br>
<input type="submit" id="contact_button" value="Send" />
</form>