Rob83
06-23-2005, 04:34 PM
Could I use str_replace to replace a string in a text box with a variable from a text box to be emailed through php?
Something like:
$message = $_POST['message'];
$sql = mysql_query("SELECT FirstName FROM users");
while($row = mysql_fetch_object($sql))
{
// Send the emails in this loop.
$member_name = $row->FirstName;
$body = str_replace('{MEMBER_NAME}', $member_name, $message);
Then in the textbox we'd use {MEMBER_NAME} To define the member name?
then something like
mail(" <$email>", "$subject", "$body", "From: $sitename<$fromemail>", "-fi$fromemail");
Something like:
$message = $_POST['message'];
$sql = mysql_query("SELECT FirstName FROM users");
while($row = mysql_fetch_object($sql))
{
// Send the emails in this loop.
$member_name = $row->FirstName;
$body = str_replace('{MEMBER_NAME}', $member_name, $message);
Then in the textbox we'd use {MEMBER_NAME} To define the member name?
then something like
mail(" <$email>", "$subject", "$body", "From: $sitename<$fromemail>", "-fi$fromemail");
