hi ,
i am making a newsletter. There is a form and its has 3 fields:
to:
subject:
Message
there is a buttons, "get all members email address".
i want that when i click on "get all members email adress", my program will automatically fill the "TO" input box with all the available email addresses in databses.
how can i implement this
plz help in this regard.
bye
a simple problem
Moderator: General Moderators
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
Code: Select all
<?php
if (isset($_GET["action"])){
if ($_GET["action"] == "getAllMailAddresses"){
$toAddress = array();
$query = "select Email from Members_tbl";
$result = mysql_query($result);
if (is_resource($result)){
if (mysql_num_rows($result)){
while($row = mysql_row($result)){
array_push($toAddress, $row[0]);
}
}
}
}
}
$mailList = implode(",",$toAddress)
?>Code: Select all
<input type = 'text' name='to' value = '<?php echo $mailList; ?>' />
<input type = 'button' value = 'get all mail addresses' onclick = 'window.location=<?php echo $_SERVER["PHP_SELF"] ?>?action=getAllMailAddresses' />