【发布时间】:2021-02-12 19:11:29
【问题描述】:
遗憾的是,我的句法知识不是应有的水平,我很确定我犯了非常愚蠢的错误。
我有一个 HTML 表单和 php 文件,它们都存在于我的服务器上。 发送时,我收到一封电子邮件,但未填充 html 表单中的值。 谁能发现我哪里出错了。
HTML 是:
<form action="contact.php" mothod="post" id="contact-form" target="blank">
<input class="form-control input-outline" id="formName" type="text" name="formName" placeholder="Full name:">
<input class="form-control input-outline" id="formEmail" type="text" name="formEmail" placeholder="Email address:">
<textarea class="form-control input-outline" id="formMessage" rows="6" cols="50" name="formMessage" placeholder="Message"></textarea>
<button type="submit">Submit</button>
</form>
PHP 是:
<?php
$email_to = "myemail@myaddress.co.uk";
$email_subject = "New form submissions";
$name = $_POST['formName']; // required
$email = $_POST['formEmail']; // required
$message = $_POST['formMessage']; // required
$headers .= "\r\n Name: " . $name;
$headers .= "\r\n Email: " . $email;
$headers .= "\r\n Message: " . $message;
@mail($email_to, $email_subject, $headers);
?>
如果可以解释我的错误,以便我能从中吸取教训,那就太棒了。
附言
在我的办公桌前已经很长时间了,现在正在编码,所以如果这是一个非常愚蠢的错误,那么感谢您对我的耐心。
一切顺利 - W
【问题讨论】:
-
“html表单中的值没有被填充”是什么意思?