我只是嘗試使我的網站上的html看起來不錯,但我不知道如何讓它與PHP工作因爲它發送電子郵件到webmail獲取空白信息,所以任何人都可以幫助我更好的PHP形成。感謝聯繫表格在webmail中空白
<form id="main-contact-form" name="contact-form" method="post" action="sendemail.php">
<div class="row wow fadeInUp" data-wow-duration="1000ms" data-wow-delay="300ms">
<div class="col-sm-6">
<div class="form-group">
<input type="text" name="name" class="form-control" placeholder="Name" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input type="email" name="email" class="form-control" placeholder="Email Address" required>
</div>
</div>
</div>
<div class="form-group">
<input type="text" name="subjects" class="form-control" placeholder="Subject" required>
</div>
<div class="form-group">
<textarea name="message" id="message" class="form-control" rows="4" placeholder="Enter your message" required></textarea>
</div>
<div class="form-group">
<button type="submit" class="btn-submit">Send Now</button>
</div>
</form>
這個文件是sendemail.php
<?php $name = $_POST['name'];
$email = $_POST['email'];
$subjects = $_POST['subjects'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "[email protected]";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>
獲取空白信息仍然是同樣的問題。所以任何機會新的PHP腳本更好呢? –
如果它不起作用,你應該檢查$ subject和$ message變量是否包含任何數據。所以把這個:echo $ subjects。「」。$ message; – Arizona2014
如果它不起作用看看這個例子... http://www.freecontactform.com/email_form.php – Arizona2014