|
Posted by Frank van Meurs on 06/25/06 21:57
Ben Holness wrote:
> Hi all,
>
> I have a function, say:
>
> function printTable($Variables)
> {
> ?>
> <table>
> <tr><td>Your name is</td></tr>
> <tr><td>
> <?php
> print $Name;
> print "</td></tr></table>";
> }
>
> I have been asked to have the system send this data table by email, so
> what I want to do is run the function, but send the output of the function
> to a variable, in the same way that print_r($arr,1) will return the output
> instead of printing it.
Like this?
function printTable($Variables, $return = false)
{
$tableHtml = "
<table>
<tr><td>Your name is</td></tr>
<tr><td>$Name</td></tr>
</td></tr></table>";
if($return){
return $tableHtml;
} else {
echo $tableHtml;
return;
}
}
[Back to original message]
|