Sorry for the long delay but a million things happened in between and I am just able to get back to it now.
Here is the code that displays the categories in the form:
Code:
<input type="checkbox" name="categories[]" value="'.$row['cat_id'].'">' .$row['category']
Here is the code adapted from your code above:
Code:
$subject2 = "Maui Wedding Club Information Request";
$headers2 = "From: Maui Wedding Club <noreply@mauiweddingclub.com>\n";
include_once('db-connect.php');
if (isset($_POST['categories'])) { //make the checkmarks with name categories[]
foreach ($_POST['categories'] as $cat) {
$email_query = mysql_query("SELECT email FROM members WHERE member_id IN(SELECT member_id FROM membercat WHERE `cat_id` = '" . $cat . "'"));
if (mysql_num_rows($email_query)) {
while ($to_member = mysql_fetch_array($email_query)) {
mail($to_member, $subject2, $body2, $headers2);
}//end while
}//endif
}//end foreach
mail(info@mauiweddingclub.com, $subject2, $body2, $headers2);
}//endif
1) Is there a way to test the mailing without sending out any messages but still showing me where the messages would have been sent and what they would look like?
2) I suspect there will be a problem with the value of $cat which needs to be equal to the cat_id (an integer) but it looks as if it would be cat_id joined with category name. The membercat table has only 2 fields: member_id and cat_id so category description is not in that table.
3) When you click Reply to a noreply@domain.com address, does it always let you know immediately that the message cannot go? I find with forms, people often Reply instead of clicking on the client's email link.
As soon as I get this form working I can launch the site, so I am very eager. Thanks for any assistance. Mahalo!
Bookmarks