in the following code, which take a template (who is places in $arr_t1 or $arr_t2), fill it with the info from a form, to be emailed with mail() to a receiver :
$domail = 1;
while ($domail <= $nr_mail):
if ($domail == 1) $var2use = $arr_t1; else $var2use = $arr_t2;
for ($index = 0; $index < count($var2use); $index++)
{
$pattern = ereg("{{[A-z0-9_]*}}", $var2use[$index]);
if ($pattern)
{
$line = ereg_replace("{{","$",$var2use[$index]);
$line = ereg_replace("}}","",$line);
}
else
{
$line = $var2use[$index];
}
$line = addslashes($line) . "<br>";
eval( "\$line = \"$line\";" );
if ($index == 0 && $domail == 1) $linetot1 = $line;
elseif ($index > 0 && $domail == 1) $linetot1 .= $line;
if ($index == 0 && $domail == 2) $linetot2 = $line;
elseif ($index > 0 && $domail == 2) $linetot2 .= $line;
}
++$domail;
endwhile;
In the resulting mail, all ' are replaced by \ if coming from the form (and folowing text is cut) and all ' from the template are replaced by \' (but this time text following is shown)
all " from templates are replaced by \" (which destroys my hrefs links) and are simple not displayed if coming from the form (wuith following text not displayed)
what function could I use in my code for all ' and " to be displayed in the resulting mail messages???
ex info from template in email : d\'artiste
ex from coming from form : jeanne d\
PHP4.0.1.pl2 win32
apache 1.3.12 win32