I'm working on an application that will allow someone to view all attendees
for a specific webinar that my company is hosting.  I want to allow the user
to send one group email to all participants scheduled for that particular

After I connect to my database my code looks like this:

      $sql = "select * from webusers where webdate=\"$webdate\"";
      $result = mysql_query($sql) or die("couldn't generate a list of the

    while ($row = mysql_fetch_row($result))
      $real_name = $row[1];
      $email = $row[12];
      $list[] = $email;

       echo "<form method=\"post\" action=\"doemailattendees.php\">\n";
       echo "<table width=\"100%\" border=0 cellspacing=0 cellpadding=0
       echo "<tr>\n";
       echo "<td valign=\"top\"><p><b>To:</b></p></td>\n";
       echo "<td valign=\"top\"><p>\n";
       foreach ($list as $value)
         print "$value, ";
         $to = $value;
       echo "</p></td>\n";
      echo "</tr>\n";

    echo "</table>\n";
    echo "<table width=\"100%\" border=0 cellspacing=0 cellpadding=0>\n";
      echo "<tr>\n";
       echo "<td valign=\"top\"><p><b>Subject:</b></p></td>\n";
       echo "<td valign=\"top\"><p><input type=\"text\"
      echo "</tr>\n";
      echo "<tr>\n";
       echo "<td valign=\"top\"><p><b>Message:</b></p></td>\n";
       echo "<td valign=\"top\"><textarea
      echo "</tr>\n";
      echo "<tr>\n";
       echo "<td colspan=2 valign=\"top\"><input type=\"submit\"
      echo "</tr>\n";
    echo "</table>\n";
      echo "</form>\n";

The $to, $subject, & $message variables then get sent to a page that
actually mails the message.  The problem I'm having is that it's only being
sent to the last person in the array.  I understand why this is happening
but don't know enough about arrays to find a solution.  As my code shows I
ambitiously tried setting $to to the entire array but that doesn't work.

If anyone would be kind enough to help me out I'd greatly appreciate it.

Thank you.


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to