在index.php頂部的PHP代碼。每當我點擊提交它顯示發送的消息,但它會生成一個空白的電子郵件到我的電子郵件地址它不能捕獲來自後的數據。php腳本發送空白郵件無法獲取發佈數據
<?php
$emailSubject = 'Customer Has a Question!';
$webMaster = '[email protected]';
$name = $_POST['iname'];
$email = $_POST['iemail'];
$phone=$_POST['iphone'];
$question = $_POST['imessage'];
echo $name;
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Questions: $question <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
$theResults = <<<EOD
EOD;
echo "$theResults";
?>
<div class="col-lg-12">
<form name="sentMessage" action="/index.php" method="post" id="contactForm" novalidate >
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input type="text" name="iname" class="form-control"
placeholder="Your Name *"
id="name"
required data-validation-required-message="Please enter your name.">
<?php $name = $_POST['iname']; ?>
<p class="help-block text-danger"></p>
</div>
<div class="form-group">
<input type="email" name="iemail" class="form-control"
placeholder="Your Email *" id="email"
required data-validation-required-message="Please enter your email address.">
<?php $name = $_POST['iemail']; ?>
<p class="help-block text-danger"></p>
</div>
<div class="form-group">
<input type="tel" name="iphone"
class="form-control"
placeholder="Your Phone *" id="phone"
required data-validation-required-message="Please enter your phone number.">
<?php $name = $_POST['iphone']; ?>
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<textarea class="form-control"name="imessage" placeholder="Your Message *"
id="message"
required data-validation-required-message="Please enter a
message.">/textarea>
<?php $name = $_POST['imessage']; ?>
<p class="help-block text-danger"></p>
</div>
</div>
<div class="clearfix"></div>
<div class="col-lg-12 text-center">
<div id="success"></div>
<button type="submit" name="isubmit" class="btn btn-xl">Send Message</button>
</div>
</div>
</form>
這是HTML + PHP
如何發佈數據? – Tushar
等待讓我添加html代碼 –
html代碼加入@Tushar –