Okay, if I understand correctly, you have a list of members with a checkbox next to them, and only the ones that are checked get the mail sent to them?
This is the way that I have done it in the past. I assume you have a primary key with an auto_increment factor of 1 (giving each member a unique id). For purposes of clarity, we'll call this primary key member_id.
On the page where it displays the checkbox, have the name of the checkbox be something like 'mail$member_id' - some name containing the $member_id variable. Here is an example:
$results = mysql_query("SELECT * FROM members");
while($member_info = mysql_fetch_assoc($results)) {
echo "<input type='checkbox' name='mail$member_id' value='yes'>";
}
This is so that each member has their own uniquely named checkbox. In the script that the form submits to, have it go through each member in the database and check to see if mail$member_id is 'yes'. Here is an example.
$results = mysql_query("SELECT * FROM members");
while($member_info = mysql_fetch_assoc($results)) {
//sets a new variable to be mail$member_id
$temp = "mail".$member_info[member_id];
//checks to see if the member's checkbox has been checked
if($_POST['$temp'] == "yes") {
//HERE SEND THE EMAIL
}
}
Clearly for larger databases this would be extremely hard on the mail server, however if your database doesn't contain extremely large amounts of members, this little script will work just fine.
Charlotte Genevier
Webligo Group
http://www.webligo.com