Sending dropdown Form information via PHP

时间:2018-01-23 19:35:27

标签: php html

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. \n Their name is: $name.\n".
    "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> 

1 个答案:

答案 0 :(得分:1)

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" />
相关问题