首先,我告诉你我的表格。这是......
r params$number
和我的mail.php -
<form role="form" method="post" actoin="mail.php">
<div class="form-group">
<label for="email">Your e-mail address:</label>
<input type="email" class="form-control" name="email" id="email" placeholder="Your E-mail" required>
</div>
<div class="form-group">
<label for="name">Your name:</label>
<input type="name" class="form-control" name="yourname" id="yourname" placeholder="Your Name" required>
</div>
<div class="form-group">
<label for="message">Message:</label>
<textarea class="form-control" name="message" id="message" required></textarea>
</div>
<div class="sendbutton">
<input type="submit" name="submit" value="Submit" class="btn btn-primary">
</div>
</form>
但是现在我的表单没有显示任何内容或重定向mail.php 我的问题是什么?但是当我在普通表格上使用这个PHP脚本时(不是由bootstrap制作)它的工作......
抱歉我的英语不好。答案 0 :(得分:1)
测试一下。我刚刚测试了它并且它正在工作,我收到了电子邮件
<?php
if(isset($_POST['submit'])) {
$email_to = "inbox@sajidurshajib.com";
$email_subject = "Email from SajidurShajib.com";
$email = $_POST['email'];
$yourname =$_POST['yourname'];
$message = $_POST['message'];
$email_message = $yourname . '<br/>';
$email_message .= $message;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: SajidurShajib.com' . "\r\n".
'Reply-To: ' . $email . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email_to, $email_subject, $email_message, $headers);
} else {
echo "Error occures";
}
?>
HTML表单
<form role="form" method="post" action="mail.php">
<div class="form-group">
<label for="email">Your e-mail address:</label>
<input type="email" class="form-control" name="email" id="email" placeholder="Your E-mail" required>
</div>
<div class="form-group">
<label for="name">Your name:</label>
<input type="text" class="form-control" name="yourname" id="yourname" placeholder="Your Name" required>
</div>
<div class="form-group">
<label for="message">Message:</label>
<textarea class="form-control" name="message" id="message" required></textarea>
</div>
<div class="form-group">
<input type="submit" name="submit" value="Submit" class="btn btn-primary">
</div>
</form>
从@
移除了mail()
。已将elase
更改为else
。错字actoin
而不是action