感谢您回答我之前的查询,但由于我不知道我错过了什么或者我错在哪里,所以我又被暂停了。下面是HTML表单我做:表单代码和PHP
<div class="container">
<span class="reg"> <h1>Register Now</h1> </span>
<div class="row">
<div class="conent-part">
<div class="form-body">
<div class="fome-body">
<form id="form" action="/sendform.php" method="post">
<div class="row">
<div class="form-part">
<div class="form-group">
<input type="text" class="form-control" name="name" id="name" placeholder="Your Name">
</div>
<div class="form-group">
<input type="email" class="form-control" name="email" id="email" placeholder="Your Email Address">
</div>
<div class="form-group">
<input type="text" class="form-control" name="nname" id="nname" placeholder="Nominee's Name">
</div>
<div class="form-group">
<input type="email" class="form-control" name="nemail" id="nemail" placeholder="Nominee's Email">
</div>
</div>
<div class="form-part">
<div class="form-group">
<input type="text" class="form-control" name="nsport" id="nsport" placeholder="Nominee's Sport">
</div>
<div class="form-group">
<textarea class="form-control" rows="3" name="accomplishments" id="accomplishments" placeholder="Accomplishments"></textarea>
</div>
</div>
</div>
<div class="custom_btn">
<button type="submit" name="submit" class="btn btn-primary">Submit</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
这里是我刚才提出的sendform.php代码,但它不会发布,它只是给sendform.php空白页。
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$nname = $_POST['nname'];
$nemail = $_POST['nemail'];
$nsport = $_POST['nsport'];
$message = $_POST['accomplishments'];
$from = $from = $email;
$to = '[email protected]';
$subject = 'Athlete of the Week - Nomination';
$body = "From: $name\n Email: $email\n Nominee's Name: $nname\n Nominee's Email: $nemail\n Nominee's Nominee's Sport: $nsport\n Accomplishments:\n $accomplishments";
?>
<?php
if ($_POST['submit']) {
if (mail ($to, $subject, $body, $from)) {
echo '<p>Your Nomination has been Successfully Sent!</p>';
} else {
echo '<p>Oops! An error occurred. Try sending your Nomination again.</p>';
}
}
?>
你有错误/警告止跌回升? – 2014-10-19 09:55:00
@ DanielA.White不,没有生成error.txt或任何错误。当我点击Submit按钮时,它会转到/sendform.php,这只是一个空白页面。 – 2014-10-19 09:57:24