Jeffro
09-06-2008, 01:13 PM
I am in the process of creating a page where I can email people in my database by checking a box next to their username.
The way I have it set up, the page where I type in my message his this script to get all of the emails and give them a checkbox. $sql = "select * from member";
$result=mysql_query($sql);
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$username=mysql_result($result,$i,"username");
$email=mysql_result($result,$i,"email");
echo "<input type='checkbox' name='email$i' value='$email'>$username<br>";
$i++; }
Then, after you submit the form, I go to a page with phpMailer. Now, my problem is getting each email address. Here's my code:
$i = 0;
while($i <$numpeeps) {
$emaili = "email$i";
if ($emaili) {
$mail->AddBCC("$email0");
echo "$email0";
}
$i++;
}
I need to get it so that it will go through each checkbox name ($email0, $email1, ect) until it reaches the max ($numpeeps) in this part of the script:
$mail->AddBCC("$email0");
echo "$email0";
The way I have it set up, the page where I type in my message his this script to get all of the emails and give them a checkbox. $sql = "select * from member";
$result=mysql_query($sql);
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$username=mysql_result($result,$i,"username");
$email=mysql_result($result,$i,"email");
echo "<input type='checkbox' name='email$i' value='$email'>$username<br>";
$i++; }
Then, after you submit the form, I go to a page with phpMailer. Now, my problem is getting each email address. Here's my code:
$i = 0;
while($i <$numpeeps) {
$emaili = "email$i";
if ($emaili) {
$mail->AddBCC("$email0");
echo "$email0";
}
$i++;
}
I need to get it so that it will go through each checkbox name ($email0, $email1, ect) until it reaches the max ($numpeeps) in this part of the script:
$mail->AddBCC("$email0");
echo "$email0";