Page 1 of 1

problem with mailing html/mysql variables

Posted: Wed Apr 07, 2004 12:09 pm
by havik
hello,

i found a code that helped me on the way with html-format mailing but i'm still a bit stuck with it

Code: Select all

$headers .= chunk_split (base64_encode("<tableborder=1><tr><td><b>Naam Personeelslid</td><td><b>personeelsnummer</td><td><center><b>ma</td><td><b><center>di</td><td><b><center>woe</td><td><b><center>do</td><td><b><center>vrij</td><td><b><center>za</td><td><b><center>zo</td><td><b><center>Km</td><td><b><center>werfnummer</b></td></tr>"));
that part works just fine, what i'm trying to get is a mail with htmlstyle table but the data inside the table pulled out of my dbase

Code: Select all

$headers .= chunk_split (base64_encode ("<table border=1><tr><td><b>Naam Personeelslid</td><td><b>personeelsnummer</td><td><center><b>ma</td><td><b><center>di</td><td><b><center>woe</td><td><b><center>do</td><td><b><center>vrij</td><td><b><center>za</td><td><b><center>zo</td><td><b><center>Km</td><td><b><center>werfnummer</b></td></tr><tr><td><?php echo "$naam"; ?></td><td><?php echo "$persn"; ?></td><td><?php echo "$ma1"; ?></td><td><?php echo "$di1"; ?></td><td><?php echo "$woe1"; ?></td><td><?php echo "$do1"; ?></td><td><?php echo "$vrij1"; ?></td><td><?php echo "$za1"; ?></td><td><?php echo "$zo1"; ?></td><td><?php echo "$km1"; ?></td><td><?php echo "$werfn1"; ?></td></tr>"));
as u veterans will see the quotes (") give trouble
is there any that knows of a code or way to fix the quote problem?

ty for looking

Posted: Wed Apr 07, 2004 12:17 pm
by phait
how about assigning a var then building it up as you go along.
For example:

[do db stuff here and assign all your vars ready to use]

$msg = '';
$msg .= '<table border="1"><tr>';
$msg .= '<td>'.$firstVarhere.'</td>';
$msg .= '<td>'.$secondVarhere.'</td>';
..etc..

and then just assign $msg for the headers part. At present what you have looks a nighmare noth in terms of quotes and just finding where a variable is.

Just a suggestion anyways.