Hi, Im a newbie to all this and need a little bit of help.
I am making an email newsletter mailing application for my own use. In the frontend of it I have a list of emails each with a checkbox next to it. I am wanting to be able to select the relevant checkbox associated with each email and then click the "send" button to send an email to the selected email address.
Please can you have a look at my code for the page that the form is sent to, as I am getting no errors but the emails arent sending.
Many thanks in advance
<?php
include_once 'connect_to_mysql.php';
$checkbox = $_POST['checkbox']; //from name="checkbox[]"
$countCheck = count($_POST['checkbox']);
if($_POST['send']) // from button name="send"
{
$subject = $_POST['subject'];
$message = $_POST['message'];
for($i=0;$i<$countCheck;$i++)
{
$del_id = $checkbox[$i];
$website_query = "SELECT email FROM newsletter WHERE id='$del_id'";
$website_result = mysql_query($website_query) or die(mysql_error());
$website_row = mysql_fetch_array($website_result);
mail('$website_row', $subject, $message, "From: newsletter@mydomain.com\r\nBcc: $to");
}
}
?>