Page 1 of 1

How would I do this??

Posted: Mon May 15, 2006 7:46 am
by lucas20042004
Hi, how would I do this:

I want to make a blank page with a link. But when you click the link it gathers every email address that is in a table on my mysql database and copys them into my email client ready for sending an email? Thanks
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.

Posted: Mon May 15, 2006 9:47 am
by BadgerC82
Hi,

One solution would be to select all the emails out and then put them in a mailto link... ie.

Code: Select all

<a href="mailto: someone@something.com; someone2@something.com">my link</a>
You could do this with:

Code: Select all

$query = "SELECT email_address FROM my_contacts";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);

for($i = 0l $i < $num_rows; $i++)
{
     $email_addresses = $row->email_address;
     if($i + 1 != $num_rows){
          $email_address .= ",";
     }
}

$link = "<a href=\"mailto: $email_addresses\">my link</a>";
:)[/quote]