Hi
I have a list of email addresses on mysql database. the user can fill out a form, click a button and the next script should email everyone from the list of emails on my database. but for some reason it only emails one person from the list. the script is below:
<?php
include "connections.php" ;
$subject = $REQUEST['subject'] ;
$message = $REQUEST['message'] ;
$query = "SELECT email FROM signup_leeds" ;
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
$data = mysql_fetch_array($result);
$to = $data['email'];
if ( mail($to,$subject,$message) ) {
echo "The email has been sent!";
} else {
echo "The email has failed!";
}
print "<br /><a href=admin_main.php>Click here to return to admin page</a>" ;
?>
can anyone please help!!???
cheers!!! 🙂