I am new to PHP and I have a contact form on my website where the last field is a dropdown menu from which you need to select an option. The form gets returned with all the info except the option selected in the dropdown menu.
My coding: HTML
<select id="Product Enquiry" name="productenquiry">
<option value="Brochure Design">Brochure Design</option>
<option value="Corporate Packages">Corporate Packages</option>
<option value="Flyer Design">Flyer Design</option>
<option value="Logo Design">Logo Design</option>
<option value="Web Design">Web Design</option>
<option value="Other">Other</option>
</select>
PHP
<?php
$name = $_GET['name'] ;
$cellnumber = $_GET['cellnumber'] ;
$email = $_GET['email'] ;
$comments = $_GET['comment'] ;
$product = $_GET['productenquiry'] ;
if (($name=="")||($email=="")) {
print("<Script>alert('Please complete the name and e-mail details.');window.history.back();</script>") ;
} else {
$content = "<b>Name:</b> " . $name ." <br><br> <b>Cell Number:</b> " . $cellnumber ." <br><br><b>E-mail:</b> " . $email . " <br><br> <b>Comments:</b> " . $comments . " <br> <br> <b>Product:</b> " . $productenquiry . " <br>";
$admin = "info@ceedeecee.co.za" ;
$from = "info@ceedeecee.co.za";
$subject = "Please Quote Me!";
$html_data = "<HTML><BODY><table width=100% bgcolor=#dddddd cellspacing=1 cellpadding=10 align=center>
<tr bgcolor=white><td><font size=2 face=verdana><Br><br>".$content."</font></tr></table></BODY></HTML>";
$headers = "Content-Type: text/html; charset=iso-8859-1\r\n" ;
$headers .= "From: info@ceedeecee.co.za\r\n";
$mail = mail($admin, $subject, $html_data, $headers);
if (!$mail) {
print("<Script>alert('Unfortunately there has been an error. Please try again in 5 minutes.');window.history.back();</script>") ;
} else {
print("<Script>alert('Thank-you for your email! We will be in touch with you soon!');window.location='http://www.ceedeecee.co.za/';</script>") ;
}
}
?>
Any help would be greatly appreciated!
UPDATE: THIS WORKS!
PHP
$name = $_GET['name'] ;
$cellnumber = $_GET['cellnumber'] ;
$email = $_GET['email'] ;
$comments = $_GET['comment'] ;
$productenquiry = $_GET['productenquiry'] ;