teanza Posted February 12, 2009 Share Posted February 12, 2009 hey guys- i just finished a site, and need the submit button to send the information to different email addresses per the drop-down selection. does anyone know where i can find this script? i tried sites like hotscripts.com, but i am unsure i am even searching for the right thing! thanks SO MUCH, ~tina~ Quote Link to comment Share on other sites More sharing options...
mike12255 Posted February 12, 2009 Share Posted February 12, 2009 you can learn it here: http://ca2.php.net/manual/en/function.mail.php Quote Link to comment Share on other sites More sharing options...
npsari Posted February 12, 2009 Share Posted February 12, 2009 This question is very general It will be better if you explain a little more Anyway, this can be done in HTML Just use a normal submit form <form name="Form" method="POST" action="/handle/" id="main_form"> </form> and then put a drop down list inside <select name="combobox" size="1"> <option>Words</option> <option>Words</option> <option>Words</option> <option>Words</option> <option>Words</option> <option>Words</option> </select> Then you use the email function <?php if(mail($Send_to, $Subject, $Message, "From: $Sender")){ print"<br><br><FONT style=\"font-size:26px\" color=\"#009300\" face=\"Arial\"><B>Sent to: $SendTo ... Sender: $Sender</B></FONT>"; }else{ print"<br><br><FONT style=\"font-size:26px\" color=\"#FF0000\" face=\"Arial\"><B>Did not send to: $SendTo ... Sender: $Sender</B></FONT>"; } ?> Quote Link to comment Share on other sites More sharing options...
teanza Posted February 16, 2009 Author Share Posted February 16, 2009 hey thanks guys. what i need is per a dropbox selection (which is named "complexes"), the submission will go to an email based on the user's selection. here is the code i have that does not work. it doesn't send the email or redirect the page, let alone send to multiple email addresses. <?php $EmailFrom = Trim(stripslashes($_POST['email'])); $EmailTo = "xxx@yahoo.com"; $Subject = "Message from contact form at xxx.com"; $FirstName = Trim(stripslashes($_POST['firstname'])); $LastName = Trim(stripslashes($_POST['lastname'])); $Email = Trim(stripslashes($_POST['email'])); $Phone = Trim(stripslashes($_POST['telephone'])); $Complexes = Trim(stripslashes($_POST['complexes'])); $Comment = Trim(stripslashes($_POST['additionalwords'])); $Body = "Hello. Someone has sent you a message from your website xxx.com"; $Body .= "\n"; $Body .= "firstname: "; $Body .= $FirstName; $Body .= "\n"; $Body .= "lastname: "; $Body .= $LastName; $Body .= "\n"; $Body .= "email: "; $Body .= $Email; $Body .= "\n"; $Body .= "telephone: "; $Body .= $Phone; $Body .= "\n"; $Body .= "complexes: "; $Body .= $Complexes; $Body .= "\n"; $Body .= "additionalwords: "; $Body .= $Comment; $Body .= "\n"; $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=http://xxx/thankyou.html\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=http://xxx/error.html\">"; } ?> any help is awesome! ~tina~ Quote Link to comment Share on other sites More sharing options...
teanza Posted February 17, 2009 Author Share Posted February 17, 2009 hey guys some nice person made this for me and i modified it. still doesn't work ! <?php if(isset($_POST['email'])) switch ($_POST['to']) { case 0: $to = "xxx@xxx.com"; $subject = "Website Inquiry: xxx"; break; case 1: $to = "xxx@xxx"; $subject = "Website Inquiry: xxx"; break; case 2: $to = "xxx@xxx.com"; $subject = "Website Inquiry: xxx"; break; case 3: $to = "xxx@xxx.com"; $subject = "Website Inquiry: xxx"; break; } $body = "*** " . $subject . " *** \n \n"; $body .= "Name: "; $body .= $_REQUEST["firstname"] . " " . $_REQUEST["lastname"]; $body .= "\n \n"; $body .= "Phone Number: "; $body .= $_REQUEST["telephone"]; $body .= "\n \n"; $body .= "Email Address: "; $body .= $_REQUEST["email"]; $body .= "\n \n"; $body .= "Comments: \n \n"; $body .= $_REQUEST["additionalwords"]; $body .= "\n \n"; $body .= "Complexes: \n \n"; $body .= $_REQUEST["complexes"]; $msgError = "error.html"; $msgSuccess = "thankyou.html"; $header = "From: ". $_REQUEST["firstname"] . " " . $_REQUEST["lastname"] . " <" . $_REQUEST["email"] . ">\r\n"; if (mail($to, $subject, $body, $header)) { echo $msgSuccess; } else { echo $msgError; } } { ?> thanx if anyone helps ~tina~ Quote Link to comment Share on other sites More sharing options...
Solar Posted February 17, 2009 Share Posted February 17, 2009 If it isn't sending, Do you have a mail server? Quote Link to comment Share on other sites More sharing options...
teanza Posted February 17, 2009 Author Share Posted February 17, 2009 yeah i just go through godaddy (linux). do i need 2 do something on that end? Thanks! ~tina~ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.