PDA

View Full Version : Loop address for club email


Bike Racer
05-06-2008, 04: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">
<p>Subject
:
<input name="subject" type="text">
<br />
<br>
Your Email:
<input name="remail" type="text">
<br>
Message:<br>
<textarea name="message" rows="15" cols="40"></textarea>
<br>
<input type="submit">
</p>
</form>

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'];
$headers=$_POST['remail'];

mail($to, $subject, $message, $headers);
}
?>

davidj
05-06-2008, 05: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, 06: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.

davidj
05-06-2008, 07:08 PM
ok

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, 07:20 PM
Interesting - I'll give it a shot.
Thanks.

Bike Racer
05-06-2008, 07: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.

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