ive had this site a while. Now i need to change the php for different departments. I already added an array to both the contact page and to the php code, but for some reason, no matter what department is chosen, it sends to all of the email addresses. This is the section of my contact page with the array and attached is my php script </td> </tr> <tr> <td valign="middle" width="24%" align="center"><font face="Adobe Garamond Pro" size="4" color="white"> <label for="reason">Reason for contacting us *</label></font> </td> <td valign="middle" width="33%"> <select name="emailaddress" id="emailaddress"> <option value="1" selected="selected">Booking</option> <option value="1">More info</option> <option value="1" >Show dates</option> <option value="1">Other</option> <option value="0">Webmaster</option> </select> </td> </tr> HTML:
Ummm... you have mail("mmorena@gmail.com", $subject, $message, $from); mail("chris@dhatura.net", $subject, $message, $from); $emailaddress = array(); $emailaddress[0] = "chris@dhatura.net" ; $emailaddress[1] = "mmorena@gmail.com" ; PHP: but you need to comment out the first two mail commands and put in logic to use the right email address per department.
this is the first time i have ever had to use multiple recipients for different departments, so i am kinda a newb in this department. i can do html and flash with my eyes closed but am still learning php. So, what you said may very well be true, it was kinda like speaking a foreign language to me, when i just learned how to say hello
SO FRIGGIN FRUSTRATING!!! ok here it is. i thought i had it, but getting errors on line 59 and 62 of the php. here is the html: <td valign="middle" width="33%"> <select name="emailaddress" id="emailaddress"> <option value="recipient_1" selected="selected">Booking</option> <option value="recipient_1">More info</option> <option value="recipient_1" >Show dates</option> <option value="recipient_1">Other</option> <option value="recipient_0">Webmaster</option> </select> </td> </tr> here is the php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Sendemail Script</title> </head> <body> <?php $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $visitor = $_POST['visitor']; $visitormail = $_POST['visitormail']; $notes = $_POST['notes']; $attn = $_POST['attn']; if (eregi('http:', $notes)) { die ("Do NOT try that! ! "); } if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) { echo "<h2>Use Back - Enter valid e-mail</h2>\n"; $badinput = "<h2>Your message was not sent</h2>\n"; echo $badinput; die ("Go back! ! "); } if(empty($visitormail) || empty($notes )) { echo "<h2>Use Back - Please complete all fields</h2>\n"; die (""); } $todayis = date("l, F j, Y, g:i a") ; $attn = $attn ; $subject = $attn ; $notes = stripcslashes($notes); $message = " $todayis [EST] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n "; $recipients = array( $recipient_1 = "mmorena@gmail.com" ; <<<<<<<<<<<<<<<<<<<<<<<------------line 59 $recipient_0 = "chris@dhatura.net" ; ); <<<<<<<<<<<<<<<<<<<<<<<------------line 62 $my_email = $recipients[$_REQUEST['recipient']]; $from = "From: $visitormail\r\n"; mail($my_email, $subject, $message, $from); ?> <p align="center"> Date: <?php echo $todayis ?> <br /> Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) <br /> Attention: <?php echo $attn ?> ( <?php echo $attn ?> ) <br /> Message:<br /> <?php $notesout = str_replace("\r", "<br/>", $notes); echo $notesout; ?> <br /> <?php echo $ip ?> <br /><br /> <a href="thankyou.html"> Next Page </a> </p> </body> </html>