Hi kwylez,
I really appreciate your help. I am rather new to php and this seems to be the only thing that is giving me such a problem. I still have been unable to figure anything out. I am using 2 separate pages for this particular script, and have copied the entire code here. As I said, if I just use the script without the form, the correct information goes out to each user. With the form, it only goes out with the first users information in the array, but goes to all users.
<tr>
<td width="100%" bgcolor="#FFFFFF">
<p align="center"><p align="center"><font color="#6C7DBF"><br><br>
EMail All Members</font></p>
<p align="center"><font color="#6C7DBF"><html>
<form name="form1" method="post" action="send.php">
<table width="100%" border="0" cellspacing="5" cellpadding="0" height="8">
<tr>
<td height="2" class="btext" colspan="7"> </td>
</tr>
<tr>
<td height="2" class="btext" colspan="7">
<div align="center">
Subject:<br><input type="text" name="subject" size="45">
<br>
Message:<br><textarea name="message" cols="45" rows="15" wrap="PHYSICAL"></textarea>
<br>
<input type="submit" name="submit" value="send now">
</form>
</body>
</html>
</font></p>
<?php
include("foot.php");
?>
/////////////// end of page......... begin next page/////////////////////
<?php
$result = mysql_query("SELECT * FROM user order by id desc");
$num_rows = mysql_num_rows($result);
$a_row = "";
while($a_row = mysql_fetch_array($result)) {
extract($a_row);
$id = $a_row['id'];
$contact = $a_row['contact'];
$firstname = $a_row['firstname'];
$subject = stripslashes($subject);
$subject = str_replace("\"", "%quotes%", $subject);
$subject = str_replace("~firstname~",$firstname,$subject);
$subject = str_replace("~lastname~",$a_row['lastname'],$subject);
$message = stripslashes($message);
$message = str_replace("~firstname~",$firstname,$message);
$message = str_replace("~lastname~",$a_row['lastname'],$message);
$message = str_replace("~joined~",$a_row['joined'],$message);
$message = str_replace("~userid~",$a_row['userid'],$message);
$message = str_replace("~referred~",$a_row['referred'],$message);
$message = str_replace("~ssn~",$a_row['ssn'],$message);
$message = str_replace("~deletedstatus~",$a_row['deletedstatus'],$message);
$from = "me";
$fromemail = "me@mydomain.com";
$headers = "From: \"$from\" <$fromemail>\n" .
"MIME-Version: 1.0\n" .
"Content-Type: text/plain\n" .
"Content-Transfer-Encoding: 7bit\n" .
"Return-Path: $fromemail\n";
mail($contact, $subject, $message, $headers)
or print "Could not send mail";
}
echo "<center>Successfully sent to all $num_rows Members!";
?>
<?php
include("foot.php");
?>
////////////////////////////////////// I've left out some non important pieces of code, such as open mysql and close, because that isn't relevant to the issue.
I appreciate any help I can get.
Thanks,
Kayb