Hi

I am trying to loop the contents of a recordset to pass through the 'mailto:'
command...the recordset I have set up works fine and loops the records as they are displayed in a table.

But I need the 'email' column to send it's data so when you use 'mailto:' it sends ALL the email addresses to Outlook etc instead of just the first record in the db.

ie: email1@domain.com, email2@domain.com, email3@domain.com, etc....

The mailto: I set up works but only with the first record....

<a href="mailto:<?php echo $row_rsDealers['email']; ?>">

Maybe I need to use some javascript?.....but can't find anything that suits???

BTW...this site is just an internal intranet and does not have online forms to fill in

Any help would be appreciated

Thanks

    $emails = array('aaa@example.com', 'bbb@example.com', 'ccc@example.com');
    echo '<a href="mailto:' . implode(',', $emails) . '">send mail to all</a>';
    

      Thanks...but where is the recordset data?....as you've put static email addresses?

        that was just an example. loop thru your record set and build the array of email addresses, then use the [man]implode[/man] function as above to spit out a comma separated list for your mailto tag.

          Hmmm....the version with the static addresses works fine, just struggling to implement it dynamically

            a more detailed example:

            <?php
            $result = mysql_query('SELECT email FROM table') or exit(mysql_error());
            while ($row = mysql_fetch_assoc($result))
            {
            	$emails[] = $row['email'];
            }
            
            echo '<a href="mailto:' . implode(',', $emails) . '">send mail to all</a>';
            ?>
            

              Ah!....thanks for the quick reply...I'll try it again in the morning when back in work.

              Many thanks....people like you are priceless! 🙂

                Write a Reply...