我的表单不会提交。请帮忙。我有两个额外的形式工作正常,但这一个给了我很多麻烦。我根本没有收到任何错误消息。我在php世界中相当新。看到这个似乎很简单!
签名非常沮丧的PHP初学者
<div class="popSec">
<div class="pop-outer">
<div class="pop-inner ui-btn-icon-notext ui-btn-right">
<button class="close">x</button>
<h1>Welcome to !<span>We are glad you want to connect with us!</span></h1>
<form method="post" action="VisitorForm.php">
<div class="section">Contact Information
<div class="inner-wrap ">
<label>Full Name*
<input type="text" name="fname" placeholder="First Name" style="width:49%; float: left;">
<input type="text" name="lname" placeholder="Last Name" style="width:49%;"> </label>
<label>Telephone Number <input type="number" name="phonenumber" placeholder="Phone Number"></label>
<label>Email Address* <input type="email" name="email" placeholder="Email Address"></label>
<div class="email-blast">
<input type="checkbox" name="emailblast">I would like to be added to Hopewell's email list.
</div>
</div>
</div>
<div class="section">Visit Us
<div class="inner-wrap">
<label>When do you plan on visiting?<input type="date" name="visitdate" placeholder="Select a date"></label>
</div>
</div>
<div class="section">Lets Connect!
<div class="inner-wrap">
<label>Are you seeking salvation?</label>
<input type="radio" name="Salvation" value="Yes" align="right">Yes
<input type="radio" name="Salvation" value="No" align="right">No
<br><br>
<label>Have you been baptized?</label>
<input type="radio" name="Baptism" value="Yes"> Yes
<input type="radio" name="Baptism" value="No">No
<br><br>
<label>Do you want to learn more about being baptized?</label>
<input type="radio" name="LMBaptism" value="Yes"> Yes
<input type="radio" name="LMBaptism" value="No">No
<br><br>
<label>Are you seeking a church home?</label>
<input type="radio" name="Church" value="Yes"> Yes
<input type="radio" name="Church" value="No">No
<br><br>
<label>How did you hear about us?</label>
<select name="Howyouhear">
<option value="Person">Family/Friend</option>
<option value="Website">Website</option>
<option value="Social">Social Media</option>
<option value="Flyer">Flyer</option>
<option value="Google">Google</option>
</select>
</div>
</div>
<button class="w3-button w3-block w3-section w3-blue w3-ripple w3-padding">SUBMIT</button>
</form>
</div>
</div>
</div>
PHP代码:
<?php
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$emailblast =$_POST['emailblast'];
$phone= $_POST['phonenumber'];
$date= $_POST['visitdate'];
$Salvation = $_POST['Salvation'];
$Baptism = $_POST['Baptism'];
$LMBaptism= $_POST['LMBaptism'];
$Church= $_POST['Church'];
$Hear= $_POST['Howyouhear'];
$fullname = $fname . ' ' . $lname ;
$formcontent="Name: $fullname Phone Number: $phone \n Email:
$email \n Date: $date \n Seeking Sal: $Salvation \n Baptized: $Baptism \n
Learn More: $LMBaptism \n Church Home: $Church \n How did you hear about us:
$Hear \n" ;
$recipient = "88888888@gmail.com";
$subject = "Visitor Online Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>