I have a form that conatins teh field and its inserted into the database now if i want to send mail to all who has checked it i did so but couldnt complete it
$querystr = mysql_query("SELECT * FROM wsd_members WHERE promos=1";); PHP: This isn't so optimized, query will take longer, but should work. On your code, query wasn't executed, and if was executed, to all the members was going to send the email, because == 1 is similar to == true (I think, even if 0 still true, value existed).
The mail() function needs to have 3 mandatory parameters. You can't just do mail(); mail($to, $subject, $message); PHP:
i did so but i cant try it cuz am working on a localhost is this ok?? mysql_select_db($database_trial, $trial); $query_Recordset1 = "SELECT email FROM wsd_members where promos='1'"; $result=mysql_query($query_Recordset1); if(!$result)echo mysql_error(); while($records=mysql_fetch_array($result)){ $sender="maha@maha.com"; for($i=0;$i<count($records);$i++) mail($records[$i],$subject,$msg,$sender); } PHP:
The 4th parameter is the headers. You need to do something like this $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n"; $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n"; $headers .= 'Cc: birthdayarchive@example.com' . "\r\n"; $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n"; mail($records[$i],$subject,$msg,$headers); PHP: