freaksilver Posted June 18, 2009 Share Posted June 18, 2009 Hi there! Really new to php.. I just tried to hash out this script through a few tutorials and some internet research.. It's a form to email script with a drop down box at the top so the user can choose which department to email. It seems to be working except for some reason when I send to "Graphics", it sends twice. The other three choices appear to be working properly. Here is the html: <table id="table" border="0" cellspacing="5"><form method="post" action="sendmail.php"> <tr><td width="140" valign="top">Department:</td> <td align="left" valign="top"> <select name="department" size="1"> <option value="general">General</option> <option value="graphics">Graphics</option> <option value="sonics">Sonics</option> <option value="bookings">Booking</option> </select> </td></tr> <tr><td width="140" valign="top">Your Name:</td> <td align="left" valign="top"><input name="name" type="text" size="50" /></td></tr> <tr><td width="140" valign="top">Reply Email:</td> <td align="left" valign="top"><input name="email" type="text" size="50" /></td></tr> <tr><td width="140" valign="top">Message:</td> <td align="left" valign="top"><textarea name="message" rows="7" cols="60"></textarea></td></tr> <tr><td width="140"></td><td valign="top"><input type="submit" value="Send Email" /></td></tr></form></table> and here is the corresponding php <?php $department = $_REQUEST['department'] ; $email = $_REQUEST['email'] ; $name = $_REQUEST['name'] ; $message = $_REQUEST['message'] ; $mailbody.="From: $name\n\n"; $mailbody.="Email: $email\n\n"; $mailbody.="Message: $message\n"; if($department == 'general') { $sendto = "[email protected]"; }elseif($department == 'graphics'){ $sendto = "[email protected]"; }elseif($department == 'sonics'){ $sendto = "[email protected]"; }elseif($department == 'booking'){ $sendto = "[email protected]"; }; if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header( "Location: http://www.embryomedia.ca/contact.html" ); }; if (!isset($_REQUEST['email'])) { header( "Location: http://embryomedia.ca/contact.html" ); } elseif (empty($email) || empty($message)) { header( "Location: http://embryomedia.ca/contacterror.html" ); } else { mail( "$sendto", "Email from embryomedia.ca Contact Form", stripslashes($mailbody), "From: $email" ); header( "Location: http://www.embryomedia.ca/thankyou.html" ); } ?> Any help would be greatly appreciated!! Thanks in advance.. Celeste Link to comment https://forums.phpfreaks.com/topic/162828-solved-form-mail-with-drop-down-multiple-emails-why-does-it-send-doubles-to-option-2/ Share on other sites More sharing options...
ldougherty Posted June 18, 2009 Share Posted June 18, 2009 I don't see anything in your code that would send the message two times. Are you sure the code itself is sending twice and that the recipients email address does not have some type of forwarder or something? Link to comment https://forums.phpfreaks.com/topic/162828-solved-form-mail-with-drop-down-multiple-emails-why-does-it-send-doubles-to-option-2/#findComment-859232 Share on other sites More sharing options...
freaksilver Posted June 18, 2009 Author Share Posted June 18, 2009 I'll double check. Thanks.. EDIT: Yes, it was a setup problem on the email end... I need to learn to have more confidence in my php skeewz.. Thx for looking over my code ldougherty! Link to comment https://forums.phpfreaks.com/topic/162828-solved-form-mail-with-drop-down-multiple-emails-why-does-it-send-doubles-to-option-2/#findComment-859238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.