joserinu Posted February 13, 2009 Share Posted February 13, 2009 Hello, I was wondering if anyone have suggest of how i should do with the email form. I already have addressbook working but i was wondering how do i get those that has been clicked then apply them to the email text input field. The user should be able to send to multiple recipents. As you can see i already have addressbook and register working. http://valleryarts.com/test/mailing.php This page is for testing to see if i can add those to other website. Link to comment https://forums.phpfreaks.com/topic/145121-email-form-to-multiple-recipents/ Share on other sites More sharing options...
phpSensei Posted February 13, 2009 Share Posted February 13, 2009 Whats your question here? you want to send emails to multiple recipents or do you want it to dynamically be added to the input text field? Link to comment https://forums.phpfreaks.com/topic/145121-email-form-to-multiple-recipents/#findComment-761648 Share on other sites More sharing options...
joserinu Posted February 13, 2009 Author Share Posted February 13, 2009 I would like it dynamically be added to the input text field. Link to comment https://forums.phpfreaks.com/topic/145121-email-form-to-multiple-recipents/#findComment-761650 Share on other sites More sharing options...
Q695 Posted February 13, 2009 Share Posted February 13, 2009 You can either do a while loop, or something like this <?php // multiple recipients $to = '[email protected]' . ', '; // note the comma $to .= '[email protected]'; // subject $subject = 'Birthday Reminders for August'; // message $message = ' <html> <head> <title>Birthday Reminders for August</title> </head> <body> <p>Here are the birthdays upcoming in August!</p> <table> <tr> <th>Person</th><th>Day</th><th>Month</th><th>Year</th> </tr> <tr> <td>Joe</td><td>3rd</td><td>August</td><td>1970</td> </tr> <tr> <td>Sally</td><td>17th</td><td>August</td><td>1973</td> </tr> </table> </body> </html> '; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n"; $headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n"; $headers .= 'Cc: [email protected]' . "\r\n"; $headers .= 'Bcc: [email protected]' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); ?> Link to comment https://forums.phpfreaks.com/topic/145121-email-form-to-multiple-recipents/#findComment-761652 Share on other sites More sharing options...
phpSensei Posted February 13, 2009 Share Posted February 13, 2009 Here i coded it for you cause i am super bored, use it as you wish <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="javascript" type="text/javascript"> function addtext(recipent,field_id){ if(document.getElementById(field_id).checked==true){ document.getElementById("recipents").value +=recipent +';'; }else{ document.getElementById("recipents").value=document.getElementById("recipents").value.replace(recipent + ';',""); } } </script> </head> <body> <p> <input name="recipents" type="text" id="recipents" size="40"> </p> <p> <input name="email_1" type="checkbox" id="email_1" onClick="addtext(this.value,'email_1')" value="[email protected]"> [email protected] </p> <p> <input name="email_2" type="checkbox" id="email_2" onClick="addtext(this.value,'email_2')" value="[email protected]"> [email protected] </p> </body> </html> Link to comment https://forums.phpfreaks.com/topic/145121-email-form-to-multiple-recipents/#findComment-761670 Share on other sites More sharing options...
joserinu Posted February 13, 2009 Author Share Posted February 13, 2009 that is interesting. You decided to use javascript. The script i have for checkbox is YEs i thought about that but it wouldn't work because the email is being predefined. The check box code is foreach ($records as $record){ $box = "<input type='checkbox' name = 'check' value='Check' '[]'>"; $fName = $record['FirstName']; $lName = $record['LastName']; $email = $record['email']; $picture = $record['Picture']; echo "<form method='POST' action=''><table><tr><td>".$box . " ". $fName ." ". $lName. " ". "<img src='".$picture ."' width='50' height='50'/> </td></tr></table></form>"; } Is there a way to use this and see if the checkbox has been checked then i can get the email from teh database to add to the text field Link to comment https://forums.phpfreaks.com/topic/145121-email-form-to-multiple-recipents/#findComment-761687 Share on other sites More sharing options...
Q695 Posted February 14, 2009 Share Posted February 14, 2009 joserinu you mean: $box = "<input type='checkbox' name = 'check[]' value='Check'>"; action isn't required you don't need quotes on: $fName = $record['FirstName']; $lName = $record['LastName']; $email = $record['email']; $picture = $record['Picture']; you check a box by using "checked" see: http://www.echoecho.com/htmlforms09.htm Link to comment https://forums.phpfreaks.com/topic/145121-email-form-to-multiple-recipents/#findComment-761849 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.