我正在尝试在我的网站上创建一个有效的PHP联系人表格,每当我填写方框并单击“提交”时,它就会带我到此链接。
当我单击我的网站上的提交时会发生什么情况
这是相关的HTML
<div class="container">
<form name="contactform" method="post" action="mail.php">
<label for="fname">First Name*</label>
<input type="text" id="fname" name="firstname" placeholder="Your name..." required>
<label for="lname">Last Name*</label>
<input type="text" id="lname" name="lastname" placeholder="Your last name..." required>
<label for="email">Email*</label>
<input type="text" id="email" name="email" placeholder="Your email..." required>
<label for="cqc">Your Comment, Quesetion, or Concern*</label>
<select id="cqc" name="cqc">
<option selected="selected" value="select_one" disabled>Select One</option>
<option value="order_status">Order Status</option>
<option value="order_cancellation">Order Cancellation</option>
<option value="volunteer_opportunities">Volunteer Opportunities</option>
<option value="feedback">Feedback</option>
<option value="other">Other</option>
</select>
<label for="message">Message*</label>
<textarea id="message" name="message" placeholder="Write something.." style="height:200px" required></textarea>
<input type="submit" value="Submit"><input type="reset" value="Clear">
<p1>
<br>
<br>
* Is a required field
</p1>
</form>
</div>
和PHP
<? php $fname = $_POST['First Name']
$lname = $_POST['Last Name']
$email = $_POST['Email']
$cqc = $_POST['Question, Comment, or Concern']
$message = $_POST['Message']
$formcontent = "From: $name \n Message: $message";
$recipient = "info@create-a-cloth.com";
$subject = "Contact Form Message";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Sorry, there was an error with the information you provided. Please double check to make sure everything is right.";
echo "Thank you for contacting us! We will respond to you as soon as possible!" . " -" . "<a href='header.html' style='text- decoration:none;color:#ff0099;'> Return Home</a>";
?>