[!--quoteo(post=332047:date=Jan 1 2006, 10:16 AM:name=tjhilder)--][div class=\'quotetop\']QUOTE(tjhilder @ Jan 1 2006, 10:16 AM) 332047[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Sorry I wasn't with it the other day lol
in the form now is:
<input type="hidden" name="email_id[]" />
and in the PHP/MySQL part is:
if (isset ($_POST['submit'])) // Handle the form.
{
foreach ($_POST['email_id'] as $email)
{
// Define the query.
$send_all = "SELECT username, email FROM members";
if ($result = mysql_query ($send_all)) { // Run the query.
$row = mysql_fetch_array ($result); // Retrieve the information.
// Send the email.
$body = "\n\nThe following message has been sent by ".$_POST['sentby']." at www.tjhilder.co.uk/index.php\n\n----------------------------------------------\n\n";
$body .= stripslashes($_POST['message']);
$body .= "\n\n----------------------------------------------\n\nIf you believe you got this e-mail by mistake, please ignore this message.\n\nPlease DO NOT reply to this message.\n";
mail($row['email'], $_POST['title'], $body, 'From: tjhilder.co.uk <admin@tjhilder.co.uk>');
$information = "<br /><br /><span style=\"color : green; font-weight : bold;\">Your E-mail has been Sent!</span>";
} else { // Query didn't run.
$information = "<br /><br />Could not send E-mail because: <b>" . mysql_error() . "</b>. The query was $send_all.";
} // End of query IF.
}
}
}
think it looks alright, just wanted to be 100% sure before I test it,.. if it goes wrong I may end up annoying alot of people at once
If your worried about the debuging stage then you can either put a limit on your select statement so that your tests only send out a few emails
and / or
set up some dummy emails accounts to your email address and adjust your sql query so those are all it finds
and / or
comment out the actual email statement and just substitute a display statement containing the email address so you can check your sql is giving you the expected data