【发布时间】:2015-01-28 22:26:56
【问题描述】:
我无法为我的联系表单正确设置 php 脚本。我设法让它给我发了电子邮件,但它没有在电子邮件中显示姓名、电子邮件或文本。
PHP 脚本
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$to = 'myemail@email.comm';
$subject = 'Hello';
mail ($to, $subject, $message, "From: " . $name);
echo "Your Message has been sent.";
?>
联系表格
<form role="form" action="contact.php">
<div class="form-group">
<label for="InputName">Name</label>
<input name="name" type="text" class="form-control" id="InputName" placeholder="Enter Name">
</div>
<div class="form-group">
<label for="InputEmail">Email Address</label>
<input name="email" type="email" class="form-control" id="inputEmail" placeholder="Enter email">
</div>
<div class="form-group">
<label for="InputText">Message</label>
<input name="message" type="text" class="form-control" id="InputText" placeholder="Enter Text">
</div>
<button name="submit" type="submit" class="btn btn-default">Send</button>
</form>
【问题讨论】: