Ok here is my code... I have another question too. How can I include in the
email a variable placed in the textarea of the form. Example: Hi your email
is $email. and it would add the variable in each email and not show $email
as plain text. Also open to any code suggestions as I am still new to php.
<?php
$connection = mysql_connect ("localhost", "root", "*****");
if ($connection == false){
echo mysql_errno().": ".mysql_error()."<BR>";
exit;
}
mysql_select_db("indywebdesign",$connection);
if ($submit) {
$sql = "SELECT * FROM email";
$result = mysql_query($sql);
while ($myrow = mysql_fetch_array($result))
{
$email = $myrow["email"];
$recipient = "$email <$email>";
$subject = "$subject";
$message = "$message";
$headers = "From: David Smith <[EMAIL PROTECTED]>\n";
mail($recipient, $subject, $message, $headers);
echo "Message Sent to $email!<BR>";
}
} else {
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<INPUT TYPE="text" NAME="subject">
<TEXTAREA NAME="message" ROWS="5" COLS="30"></TEXTAREA>
<input type="Submit" name="submit" value="Edit Information">
</form>
<?php
}
?>
-----Original Message-----
From: David Smith [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 07, 2001 1:49 PM
To: Chris Lee; [EMAIL PROTECTED]
Subject: RE: [PHP] email with multiple records
Thanks, I should have drop a code snippet in there... My problem was the .=
-----Original Message-----
From: Chris Lee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 07, 2001 11:39 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] email with multiple records
suppy a code snippit and I would have a huge advantage here, but I'll swing
in the dark on this ok.
your looping all this in a for/while/foreach loop right. your generating the
body like this ?
foreach($people as $pos => $val)
{
$email_body .= 'name is '. $people[$pos]['name'] ."\n";
$email_body .= 'email is '. $people[$pos]['email'] ."\n";
$email_body .= 'phone is '. $people[$pos]['phone'] ."\n";
mail($email_to, $email_body, $email_from);
}
right ? change it to this.
foreach($people as $pos => $val)
{
$email_body = '';
$email_body .= 'name is '. $people[$pos]['name'] ."\n";
$email_body .= 'email is '. $people[$pos]['email'] ."\n";
$email_body .= 'phone is '. $people[$pos]['phone'] ."\n";
mail($email_to, $email_body, $email_from);
}
now good change im out to lunch here, but sithout a code snippit im grabing
here. please post regarding, thank you.
--
Chris Lee
Mediawaveonline.com
ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120
[EMAIL PROTECTED]
""WreckRman2"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I wrote a small script like a email list only when I run it with 3 emails.
The first record gets his info, 2nd get his plus first, 3rd get his plus 2nd
and 1st. Why is it doing this?
David Smith
Number 3 record gets email with:
---------------------
Hi [EMAIL PROTECTED],
Your email is [EMAIL PROTECTED]
Bye, WreckRman2
---
Hi [EMAIL PROTECTED],
Your email is [EMAIL PROTECTED]
Bye, WreckRman2
----
Hi [EMAIL PROTECTED],
Your email is [EMAIL PROTECTED]
Bye, WreckRman2
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]