RE: [PHP] sending e-mail with variables
| From: | Kristian Duske | Date: | Tue, 26 Jun 2001 11:27:51 +0000 |
| Subject: | RE: [PHP] sending e-mail with variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55231@lists.php.net to get a copy of this message | ||
> $subject =$row["msub"]; //"Your webhosting account at
> $hostname.$domain$tld";
> $message .= $row["mline1"]; //"Dear $fullname,\n";
>
> $message .= $row["mline2"];//"Your webhosting account has been
> created. Please use the\n";
> $message .= $row["mline3"];//"following data to log in:\n";
> Now my problem is it does not fill in the variables when it sends the
> e-mail.The reason I am doing this is the end user of this program
> what's to be able two
> change what the e-mail says. How can I do this so it fills the
> variables in. Or am I going about this totally wrong
If I understand you correctly, you have to eval the code that you get from
the database. That would be:
$subject = eval($row["msub"]);
This interpretes the string that is stored in $row["msub"] as php code and
assings the result of the interpretation to $subject. Make sure that you
have assigned all variables that you use in $row["msub"] before you eval it.
Kristian