Code: Select all
$message = show_cv($user_id, '2');
mail ($to, $subject, $message);how to i copy all of the information echoed out by my function in a variable that i can then email to a user.
Moderator: General Moderators
Code: Select all
$message = show_cv($user_id, '2');
mail ($to, $subject, $message);Code: Select all
function bob(){
$thisVar = "this is my first line";
$thisVar .= "this is my second line";
$thisVar .= "this is my third line";
return $thisVar;
}
$larry = bob();
mail($to,$subject,$larry);exactlly, i dont see a reason why that cant be done but i just dont know of how to do it but no, you didnt waste my time you just helped me realize i need to think my code through moreBurrito wrote:hmm...dunno then, seems like there's got be a way to capture what is outputted, but I don't know it.
Code: Select all
$message = show_cv($some_id);
//automatically since i even wrote show_cv() with a real id in it is echos out the cv i entered. so right there it makes the mail function not send the cv info because when i do...
mail($to, $subject, echo'the cv info');
//well that obviously is incorrect and thats what basically being entered into the mail functionCode: Select all
//****************************************//
// display the users personal information //
//****************************************//
?>
<table border="0">
<tr>
<td width="125">
<? $lang->DoLcV('NAME'); ?>
</td>
<td>
<? $personal_info[first_name] = sanitize_html_string($personal_info[first_name]); ?>
<? echo $personal_info[first_name]; ?>
 
<? $personal_info[last_name] = sanitize_html_string($personal_info[last_name]); ?>
<? echo $personal_info[last_name]; ?>
</td>
</tr>
<?
if ($personal_info[birthday] != '0000-00-00')
{
?>
<tr>
<td>
<? $lang->DoLcV('FORM_BIRTHDAY'); ?>
</td>
<td>
<? $personal_info[birthday] = sanitize_html_string($personal_info[birthday]); ?>
<? echo $personal_info[birthday]; ?>
</td>
</tr>
<?
}
if ($personal_info[address] != '')
{
?>
<tr>
<td>
<? $lang->DoLcV('ADDRESS'); ?>
</td>
<td>
<? $personal_info[address] = sanitize_html_string($personal_info[address]); ?>
<? echo $personal_info[address]; ?>
<br>
<?
if ($personal_info[fk_dd_city] > 0)
{
ShowItem('city', $personal_info[fk_dd_city]);
}
?>
,  
<? echo $personal_info[county]; ?>
,  
<?
if ($personal_info[fk_dd_country] > 0)
{
ShowItem('country', $personal_info[fk_dd_country]);
}
?>
<br>
<? $personal_info[postal] = sanitize_html_string($personal_info[postal]); ?>
<? echo $personal_info[postal]; ?>
</td>
</tr>
<?
}
if ($personal_info[phone_contact] != '')
{
?>
<tr>
<td>
<? $lang->DoLcV('PHONE'); ?>
</td>
<td>
<? $personal_info[phone_contact] = sanitize_html_string($personal_info[phone_contact]); ?>
<? echo $personal_info[phone_contact]; ?>
</td>
</tr>
<?
}
if ($personal_info[email] != '')
{
?>
<tr>
<td>
<? $lang->DoLcV('FORM_EMAIL'); ?>
</td>
<td>
<? $personal_info[email] = sanitize_html_string($personal_info[email]); ?>
<a href="mailto:<? echo $personal_info[email]; ?>"><? echo $personal_info[email]; ?></a>
</td>
</tr>
<tr height="5">
<td colspan="2">
<? //leave this blank ?>
</td>
</tr>
<?
}
//*********************************************//
//end displaying the users personal information//
//*********************************************//Code: Select all
if ($_POST[email_selected])
{
echo '<form action="?op=do_email" method="post">';
foreach($_POST[checked] as $key => $value)
{
$query = '
SELECT
first_name, last_name
FROM
mdl_cv_personal_info
WHERE
fk_user_id="'.$value.'"
';
$do_query = mysql_query($query) or die(mysql_error().__LINE__);
$names = mysql_fetch_assoc($do_query);
$query = '
SELECT
email
FROM
mdl_usr_users
WHERE
user_id="'.$value.'"
';
$do_query = mysql_query($query) or die(mysql_error().__LINE__);
$info = mysql_fetch_assoc($do_query);
echo $names[first_name].' '.$names[last_name].'   ';
$lang->DoL('FORM_EMAIL');
echo '<input type="text" name="email['.$value.']" value="'.$info[email].'">';
echo '<input type="hidden" name="checked[]">';
echo '<br>';
}
echo '<input type="submit" name="submit" value="';
$lang->DoL('FORM_SUBMIT');
echo '"';
echo '</form>';
die();
}Code: Select all
ob_start();
show_cv($user_id, '2');
$cvs = ob_get_contents();
$cvs = strip_tags($cvs);
mail($email, 'Your CV', $cvs);
ob_end_flush();