On my website I am attempting to create a form to send email. In the form I have a drop down menu with 4 different email addresses. When a user clicks 'Submit' a php form should retrieve the info from the form and fire it off to the email address chosen from the drop down menu. Problem is, its not working. I was wondering if anyone here could let me know what I'm doing wrong!
Here is the code from the form:
<form name="form1" method="post" action="http://www.mywebsite.com/contact/send_contact.php">
To:
<select name="to">
<option value="fanmail@mywebsite.com">Fan Mail</option>
<option value="hatemail@mywebsite.com">Hate Mail</option>
<option value="booking@mywebsite.com">Booking</option>
<option value="webmaster@mywebsite.com">Webmaster</option>
</select>
Subject:<input name="subject" type="text" id="subject" size="50">
Detail:<textarea name="detail" cols="50" rows="4" id="detail"></textarea>
Name:<input name="name" type="text" id="name" size="50">
Email:<input name="customer_mail" type="text" id="customer_mail" size="50">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset">
</form>
and here is the php file that should be processing the form:
Code: Select all
<?php
$subject ="$subject";
$message="$detail";
$mail_from="$customer_mail";
$header="from: $name <$mail_from>";
$to ='$_REQUEST["to"]';
$send_contact=mail($to,$subject,$message,$header);
if($send_contact){
echo "Thank you! I hope to hear from you again soon!";
}
else {
echo "ERROR";
}
?>