我有一個簡單的聯繫人腳本,它會在提交時觸發一封電子郵件。 電子郵件已發送,但電子郵件中沒有表單值(名稱:空,...)。
爲什麼我的聯繫人腳本不工作?
<?php
if ($action == "send") //isset wyslij
{
if (!$_POST[name] || !$_POST[email] || !$_POST[phone] || !$_POST[enquiry])
{
$problem = TRUE;
echo("<p>You have to fill all form.</p>");
}
if (! $problem)
{
$data = date("d.m.y");
$message = "
<p>Name: $_POST[name]</p>
<p>Phone: $_POST[phone]</p>
<p>Email: $_POST[email]</p>
<br>
<p>Enquiry: $_POST[enquiry]</p>";
$od = "[email protected]";
$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('[email protected]', 'New message from website', $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>
儘量不要在qoute「
名稱:」中包含數組值。 $ _POST [name]。「
」; –