[英]Sending email with data from form
I have problem with simple contact box. 我有简单的联系方式的问题。 I want to send informations from form to my email.
我想从表单发送信息到我的电子邮件。
Already tried with register globals on and off (.httacess), tried with simple $formname and $_POST['formname'] but still getting email without form info. 已经尝试使用寄存器全局变量打开和关闭(.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>
<form action="contact.php?action=send" method="post" enctype="text/plain">
When POSTing forms the enctype
attribute should be application/x-www-form-urlencoded
or multipart/form-data
. 在POSTing表单时,
enctype
属性应该是application/x-www-form-urlencoded
或multipart/form-data
。
PHP does not handle forms POSTed as text/plain
. PHP不处理以
text/plain
形式发布的表单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.