hi

i have a database ..it contains employee details like name,emil,phno.....when admin sents a mail it must be forwrded to all the emp in the table..plese do tell me how to do tat

Umm..what's so difficult about it ? I hope you know the query to fetch the records from the table ?

$subject="Test mail";
$from="From : yourname@domain.com";
$query="select * from tablename";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
   $email=$row['email'];
   $name = $row['name'];
  email($email,$subject,$message,$from);
}

<form>
<?php

$subject1=$_REQUEST;

$message=$_REQUEST;

$hostname = "localhost";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");

if (isset($_REQUEST))
{

$subject="Test mail";

$from="yourname@domain.com";

$query="select email from member" or die("ERROR:".mysql_error());

$result=mysql_query($query);

while($row=mysql_fetch_array($result)){

$email=$row[0];

mail($email,$subject,$message,$from);

echo "Thanks";
}


?>
</form>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.