steviemac Posted March 5, 2007 Share Posted March 5, 2007 I am still very new to php but I have been slowly learning. I have a DB table that contains the individual e-mail addresses. I want to be able to send an email to some or all of the individuals on the table. Right now it will only send to one individual at a time. I have made an e-mail form using check boxes to select the e-mail address. <form method="post" name="bulkemail" action="bulkemail.php"> <table border="0" cellspacing="1" cellpadding="2" bgcolor="#CCCCCC" width="80%"> <tr> <td class="thetag" bgcolor="#DDDDDD">Contact_Person</td> <td class="thetag" bgcolor="#DDDDDD">email_address</td> </tr> <? $cnt = $from; while ( $row = mysql_fetch_array($result) ) { ?> <tr> <td class="thevalue" bgcolor="#FFFFFF"><? echo $row['Contact_Person']; ?></td> <td class="thevalue" bgcolor="#FFFFFF"><input name="email" type="checkbox" value="<? echo $row['email_address']; ?>"><? echo $row['email_address']; ?>[/color]</td> </tr> </td></tr> <? $cnt++; } ?> </table> <P>Subject<input name="subject" type="text" size="50"></p> <P>Comments<br> <textarea name="comments" cols="80" rows="15"></textarea> <br><br><input name="submit" type="submit" value="submit"></p> </form> I think my problem is the line that echos email_address for the check box. Each user has an individual id. I can make the check box echo there id. I'm not sure how to make id=email address. This is the submit code. I have only added where I think my problem is. $emailSubject = FilterCChars("$FTGsubject"); $emailBody = "$FTGcomments\n" . "\n" . ""; $emailTo = "<$FTGemail>"; $emailFrom = FilterCChars("[email protected]"); $emailHeader = "From: $emailFrom\n" . "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=\"ISO-8859-1\"\n" . "Content-transfer-encoding: 8bit\n"; mail($emailTo, $emailSubject, $emailBody, $emailHeader); I believe that the $emailTo is my problem. I believe I have to somehow make id=email to make everything work so it will send to multiple e-mail addresses. I will appreciate any help. Thank You Link to comment https://forums.phpfreaks.com/topic/41273-send-e-mail-to-some-or-all-email-addresses-that-are-in-a-table/ Share on other sites More sharing options...
monk.e.boy Posted March 5, 2007 Share Posted March 5, 2007 $emailBody = "$FTGcomments\n" . "\n" . ""; $emailTo = "<$FTGemail>"; $emailBody = "$FTGcomments\n" . "\n" . ""; $emailTo = $FTGemail; Your code looks a little confused. But I think you had PHP code inside a PHP code block like this: <?php <? ?> which is wrong. monk.e.boy Link to comment https://forums.phpfreaks.com/topic/41273-send-e-mail-to-some-or-all-email-addresses-that-are-in-a-table/#findComment-199986 Share on other sites More sharing options...
steviemac Posted March 5, 2007 Author Share Posted March 5, 2007 I can show that whole code. It will send an email but to only one individual checked. If I check multiple email addresses it still will only send to one address. Link to comment https://forums.phpfreaks.com/topic/41273-send-e-mail-to-some-or-all-email-addresses-that-are-in-a-table/#findComment-199994 Share on other sites More sharing options...
monk.e.boy Posted March 5, 2007 Share Posted March 5, 2007 do a: print_r( $_POST ); print_r( $_GET ); to understand what variables your form is sending to your PHP page. From this you should be able to figure it out. monk.e.boy Link to comment https://forums.phpfreaks.com/topic/41273-send-e-mail-to-some-or-all-email-addresses-that-are-in-a-table/#findComment-200013 Share on other sites More sharing options...
steviemac Posted March 5, 2007 Author Share Posted March 5, 2007 Sorry to be slow. I'm not explaining myself very well. I have made a check box for the <? echo $row['email_address']; ?> I want to be able to check multiple email addresses and have them inputed into bulkemail.php code. In the send to it has the $emailTo = "<$FTGemail>"; It will send to one but not to multiple addresses. I believe my problem is that when the table is echoed from the database all the email addresses = email I think I need to make the bulkemail.php code see there individual id and the email address associated with it to make it work. That is what I'm not sure how to do. Link to comment https://forums.phpfreaks.com/topic/41273-send-e-mail-to-some-or-all-email-addresses-that-are-in-a-table/#findComment-200031 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.