popodc Posted November 9, 2006 Share Posted November 9, 2006 [color=red]<?php[/color] if (!$excel) { echo '<tr valign="top"> <td height="25" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="1" cellpadding="0"> <tr> <td width="113" valign="middle" bgcolor="#999999"><p><font color="#000000" face="Tahoma"><strong>Employee No:</strong></font></p></td> <td width="257" valign="top" bgcolor="#CCCCCC"> <table width="100%" height="19" border="0" cellpadding="0" cellspacing="1"> <tr> <td bgcolor="#FFFFFF"><p><strong><font color="#000000" face="Tahoma"> [color=red][b]<?php echo $empid; ?>[/b][/color] </font></strong></p></td> </tr> </table>';}[color=red]?>[/color]id like to know if its possible to have a php code inside a php.. if not, how do i do this highlightext text? thanks! Quote Link to comment Share on other sites More sharing options...
btherl Posted November 9, 2006 Share Posted November 9, 2006 [code]echo '<td>' . $empid . '</td>';[/code]For example.. in your case, replace the <?php echo $empid; ?> with this:[code]' . $empid . '[/code]The dot means "stick two strings together". So you are sticking the first half of the string, $empid and the last part of the string together into one big string. That big string is then echoed. Quote Link to comment Share on other sites More sharing options...
Caesar Posted November 9, 2006 Share Posted November 9, 2006 Or...[code]<?php if (!$excel) { echo" <tr valign=\"top\"> <td height=\"25\" bgcolor=\"#FFFFFF\"><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\"> <tr><td width=\"113\" valign=\"middle\" bgcolor=\"#999999\"><p><font color=\"#000000\" face=\"Tahoma\"><strong>Employee No:</strong></font></p></td> <td width=\"257\" valign=\"top\" bgcolor=\"#CCCCCC\"> <table width=\"100%\" height=\"19\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\"> <tr><td bgcolor=\"#FFFFFF\"><p><strong><font color=\"#000000\" face=\"Tahoma\">$empid</font></strong></p></td></tr> </table>";?>[/code] Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted November 9, 2006 Share Posted November 9, 2006 i would suggest using echo <<<htmlit is much more easier. example:[code=php:0] <?php if (!$excel) {echo <<<html<tr valign="top"> <td height="25" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="1" cellpadding="0"> <tr> <td width="113" valign="middle" bgcolor="#999999"><p><font color="#000000" face="Tahoma"><strong>Employee No:</strong></font></p></td> <td width="257" valign="top" bgcolor="#CCCCCC"> <table width="100%" height="19" border="0" cellpadding="0" cellspacing="1"> <tr> <td bgcolor="#FFFFFF"><p><strong><font color="#000000" face="Tahoma">{$empid}</font></strong></p></td> </tr> </table>html;}?>[/code] Quote Link to comment Share on other sites More sharing options...
Jenk Posted November 9, 2006 Share Posted November 9, 2006 [quote author=btherl link=topic=114345.msg465206#msg465206 date=1163033996][code]echo '<td>' . $empid . '</td>';[/code]For example.. in your case, replace the <?php echo $empid; ?> with this:[code]' . $empid . '[/code]The word you seek is Concatenate :)The dot means "stick two strings together". So you are sticking the first half of the string, $empid and the last part of the string together into one big string. That big string is then echoed.[/quote] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.