I use pdf and I encountered the following problem: When I write a text everything is ok but when I want to write a dynamic text like "Hello X" where X is taken from the database it doesn't work. I mean, I didn't show the name from the database.
I write it using the code below:
$ pdf-> Write (0, 'Faculty of Aerospace', '', 0, 'L', true, 0, false, false, 0);
$ paragraph. = '
<P>
I am writing this letter in support of <? Php if ($ sex == "male"):?> Mr. <? Php else:?> Ms. <? php endif?> <? php echo $ nume_student;?>, who is a Computer-aided graphics student at our college. </p> ';
$ pdf-> Write (0, $ paragraph, '', 0, 'J', true, 0, false, false, 0);
I want to appear I am writing this letter in support of Mr...... But actual appear
I am writing this letter in support of <? Php if ($ sex == "male"):?> Mr.
You cannot use <?php .... ?>
inside a PHP string.
$pdf->Write(0, 'Faculty of Aerospace', '', 0, 'L', true, 0, false, false, 0);
$paragraph = "<p>I am writing this letter in support of " .
($sex == "male" ? "Mr. " : "Ms. ") . $nume_student .
" who is a Computer-aided graphics student at our college.</p>";
$pdf->Write(0, $paragraph, '', 0, 'J', true, 0, false, false, 0);
These are very basic syntax problems.