我已将此表单填写为电子邮件脚本,收到电子邮件后,我得到了select
以外的所有字段。没有选择选项,它可以正常工作。
请告诉我有什么问题。或者,如果我没有正确使用选择选项。
<form class="form-signin cform" method="post" action="send-sales.php" id="cform" autocomplete="on">
<div class="form-input">
<label>First name<span class="red">*</span></label>
<input type="text" required name="name" id="name">
</div>
<div class="form-input">
<label>Email<span class="red">*</span></label>
<input name="email" type="email" id="email" required>
</div>
<div class="form-input">
<label>Phone</label>
<input name="phone" type="text" id="phone">
</div>
<div class="form-input">
<label>Interested Product<span class="red">*</span></label>
<select required="required" id="product">
<option value="eerp">Educational ERP</option>
<option value="accounting">Accounting</option>
<option value="erp">ERP</option>
</select>
</div>
<div class="form-input">
<label>Message<span class="red">*</span></label>
<textarea required name="message" cols="40" rows="7" id="messageTxt" spellcheck="true"></textarea>
</div>
<div class="form-input">
<input type="submit" class="btn btn-large main-bg" value="Submit"> <input type="reset" class="btn btn-large" value="Reset" id="reset">
</div>
</form>
<?php
$email_to = "myemail@gmail.com";/* CHANGE THIS WITH YOUR OWN EMAIL ADDRESS */
$name = $_POST["name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$product = $_POST["product"];
$message = $_POST["message"];
$text = "Sender's Name: $name<br>
Sender's Email: $email<br>
Sender's Email: $phone<br>
Sender's Interested Product: $product <br>
Sender's Message: $message";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html; charset=utf-8" . "\r\n";
$headers .= "From: <$email>" . "\r\n";
mail($email_to, "Sales Message from Website", $text, $headers);
?>
答案 0 :(得分:1)
您选择的标签中缺少姓名
提供名称以选择
<select required="required" id="product" name="product">
只是。
答案 1 :(得分:1)
您需要在选择标签上具有名称属性
<select name="products">