Jump to content

a php inside php


popodc

Recommended Posts

      [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!
Link to comment
https://forums.phpfreaks.com/topic/26647-a-php-inside-php/
Share on other sites

[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.
Link to comment
https://forums.phpfreaks.com/topic/26647-a-php-inside-php/#findComment-121880
Share on other sites

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]
Link to comment
https://forums.phpfreaks.com/topic/26647-a-php-inside-php/#findComment-121883
Share on other sites

i would suggest using echo <<<html
it 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]
Link to comment
https://forums.phpfreaks.com/topic/26647-a-php-inside-php/#findComment-121985
Share on other sites

[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]
Link to comment
https://forums.phpfreaks.com/topic/26647-a-php-inside-php/#findComment-122022
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.