View Full Version : Loop address for club email

Bike Racer
05-06-2008, 03:03 PM
I'm trying to put together a form that club members can email (mass) to all members of the club. What am I doing wrong? Or am I over my head with this one?

Form Page
<form method="post" action="email2.php">
<input name="subject" type="text">
<br />
Your Email:
<input name="remail" type="text">
<textarea name="message" rows="15" cols="40"></textarea>
<input type="submit">

mail send page

?php require_once("../Connections/testserver.php");

$query =sprintf("SELECT * FROM member_list where act_mem ='Y'");
$result =mysql_query($query);
while ($row = mysql_fetch_array($result)){

$to = $row["email"];
$subject = $_POST['subject'];
$message = $_POST['message'];

mail($to, $subject, $message, $headers);

05-06-2008, 04:58 PM
you are catching form field data in your while loop???

if the email address is in the db why do you need to use a form

Bike Racer
05-06-2008, 05:14 PM
Maybe I'm going about this wrong.

My idea is to have a page where any club member can fill-out the form and then send the message via email to the members listed in the database.

05-06-2008, 06:08 PM

you need a TO field which could be a dropdown dynamicaly populated with all the email addresses in the db

then this is used to send the mail

Bike Racer
05-06-2008, 06:20 PM
Interesting - I'll give it a shot.

Bike Racer
05-06-2008, 06:23 PM
Maybe I need to explain again. The form would be sent to all members (mass) at one time. But I like the idea of the dropdown for sending individual emails.

05-06-2008, 06:31 PM
mass email *is* just a bunchload of individual email sent in a row