doudanma9706 2018-01-23 19:35 采纳率: 100%
浏览 42
已采纳

通过PHP发送下拉表单信息

A form was created with a dropdown , the results of the form are sent to a separate email. All of the items in the form are appearing except for the dropdown. Why is the dropdown result not appearing in the email?

<?php
if(!isset($_POST['submit']))
{
    //This page should not be accessed directly. Need to submit the form.
    echo "error; you need to submit the form!";
}
$name = $_POST['cd_FULLNAME'];
$visitor_email = $_POST['Email'];
$dropdown = $_POST['dropdown'];
$message = $_POST['cd_CONTACTPHONENUM'];


$email_from = 'jla3633i@gmail.com';//<== update the email addresss
$email_subject = "RRSP Campaign Phone Call Request";
$email_body = "The following information was submitted via . The prospective customer has been informed that they will be contacted by a representative within 1 business day regarding our current promotional offer. 
 Their name is: $name.
".
    "Their phone number is: $message . They prefer to be contacted at $dropdown. Their email address is: $visitor_email. This email was sent to your email address at: ". 
    
        <div class="contact-form">
                <!-- Form -->
                    <form name="lowerForm" id="lowerForm" action="form-to-email.php" method="post" onsubmit="return validate_lowerForm(this)" autocomplete="on">
                <!-- ReturnURL - when the user hits submit, they'll get sent here -->
                <input type="hidden" name="ReturnURL" value="/save/thankyou.html">
                    <!-- Left Inputs -->
                    <div class="col-xs-12 animated" data-animation="fadeInLeft" data-animation-delay="300">
                        <!-- Name -->
                        <input type="text" name="cd_FULLNAME" id="lowerName" required="required" class="form light" placeholder="Name" />
                        <!-- Email -->
                        <input type="email" name="Email" id="lowerEmail" required="required" class="form light" placeholder="Email" />
                        <!-- Subject -->
                        <input type="text" name="cd_CONTACTPHONENUM" id="lowerPhone" required="required" class="form light" placeholder="Phone Number" />
                        <!-- Send Button -->
                        <select id="dropdown" form="dropdown" name="dropdown" class="form light" />
                         <option value="" disabled selected>Preferred Contact Method</option>
    <option value="phone">Phone</option>
    <option value="email">Email</option>
  </select>
  

                                                <!-- Checkbox --><p class="service-header light white">
                

<br>
                        <button type="submit" id="lowerSubmit" name="Submit" class="form-btn light" value="Subscribe">Submit</button> 

</div>
  • 写回答

1条回答 默认 最新

  • drbii0359 2018-01-23 19:41
    关注

    Your dropdown doesn't show because you used the "form" attribute on it, pointing to a "dropdown" form that doesn't exist. Remove that and it should be fine.

    <select id="dropdown" name="dropdown" class="form light" />
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里