Re: eval results to string?
| From: | Daniel Convissor | Date: | Wed, 11 Oct 2000 14:09:54 +0000 |
| Subject: | Re: eval results to string? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19606@lists.php.net to get a copy of this message | ||
Hi Julian:
> Well, I looked into include or require, but neither can get me to a point
> where I can take the resultant data and send it off in an email message
> (that I can see). I'm still stuck with trying to get a parsed php file into
> a variable that I can pass through to the mail command.
Merge the various variables together into one variable, then pass that to the
mail function. For example:
$Body = "Name: $Name\n";
$Body .= "Address: $Address\n";
$Body .= "Phone: $Phone\n";
mail("$Email", "New Submission", "$Body");
Similarly, you can put the $Body = ... into a while list/each loop on
HTTP_POST_VARS, rather than manually writing them out in your code like this:
$Body = "";
while ( list($Key,$Val) = each($HTTP_POST_VARS) ) {
$Body .= "$Key: $Val\n";
}
> How do you mail a file that you include?
That's not what you want to do in this case, though that is doable using
fread() or fgets() to place the contents into a string variable then placing
that string variable into the mail() function.
Enjoy,
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
More than just answers. Solutions. (SM)
http://www.analysisandsolutions.com/
4015 7 Av #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409