joebpa Posted November 6, 2006 Share Posted November 6, 2006 I am attempting to have one form that can potentially send to multiple E-mail addresses depending upon which address is found in the main page. The form will send E-mail if i specify the address, but not when i use the $recipient.Windows 2003 web editionPHP 5.1.6IIS 6Here is the form:<HTML><HEAD><TITLE>mail</TITLE></HEAD><BODY><?php //define who is to receive the mail $mailTo = $recipient; //set the subject $mailSubject = $subject; //build body of the message $mailBody = "This is the content of the mail received to Prime: \n\n"; //add a from header $mailHeaders = "From: PW-Server Liberty Form Mailer\n"; //send mail // print("Submitting the following information:<P>"); while ($slice = each($_POST)){//print($slice[0]." = ".$slice[1]."<BR>"); $mailBody .= $slice[0]; $mailBody .= "=".$slice[1]; $mailBody .= "\n\n"; } if(mail($mailTo, $mailSubject, $mailBody, $mailHeaders)){ // if(mail($mailTo, $mailSubject, $mailBody, $mailHeaders)){ print("<h2>Your form was successfully submitted.</h2>"); print("<b>Thanks!</B>"); }else{ print("<h2>Submission Failed!</h2>"); }?></BODY></HTML>If i replace the $recipient with an E-mail account it will send with all information contained in the HTML form.This is what the HTML form looks like:<html><head><title>Liberty Formals</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><Body><Table> <form action="http://www.libertyformals.com/formmail.php" method="post"> <input type=hidden name="recipient" value="my@email.net"> <input type=hidden name="subject" value="Liberty Tux Reuest"> <input type=hidden name="redirect" value="http://www.libertyformals.com/contresponse.htm"> Name: <input type="text" name="Name" size="33" maxlength="100"> <br> Company: <input type="text" name="comp" size="30" maxlength="100"> <br> Address 1: <input type="text" name="add1" size="30" maxlength="100"> <br> Address 2: <input type="text" name="add2" size="30" maxlength="100"> <br> City/State/Zip: <input type="text" name="city" size="15" maxlength="100">***removed the rest so it wouldnt be so long.The form pulls the subject line and redirects me, but will not pull the recipient line?Can anyone shed some light for me. ??? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted November 7, 2006 Share Posted November 7, 2006 your not grabbing the data properly. you should be using.[code]$recipient = $_POST['recipient'];[/code]and that goes for the subject etc. I am not sure how it is pulling out the subject and the redirection without the $_POST. Quote Link to comment Share on other sites More sharing options...
joebpa Posted November 7, 2006 Author Share Posted November 7, 2006 From what you have mentioned i gather that the ($mailTo can be replaced with the $recipient in any area?). If this is true teh what you have mentioned would make sense. Does teh mailing program within PHP understand that i am not using the $mailTo, but instead the $recipient?On your comment about the posting ($_post) in teh form towards the bottom of it tehre are entries that use a $slice to pull the $_post. Is this what you were talkign about? Please bear in mind i didnt not write this i am playing catch up on the problem. 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.