|
|
|
| Мне нужно в переменную, которая содержит хтмл код, вставить пхп код
<?
$html = "
<table>
<tr>
<td>
// здесь пхп код
</td>
</tr>
</table>
";
?>
|
перепробовал кучу вариантов подскажите, плз, каким образом это можно реализовать
Заранее спасибо | |
|
|
|
|
|
|
|
для: d-111
(18.06.2006 в 12:56)
| |
<?
$html = "
<table>
<tr>
<td>".$var."</td>
</tr>
</table>
";
?>
|
В общем, надо воспользоваться конкатенацией - .. | |
|
|
|
|
|
|
|
для: Alex Kraft
(18.06.2006 в 13:12)
| | Неработает я пробовал так.
дело в том что мне нужно не переменную вставить, а условие if
<?
$html = "
<table>
<tr>
<td width=40 align=center>
<input type=radio name=bil_agr value=1".if ($bil_agr=1) echo 'checked';.">
</td>
<td width=40 align=center>
<input type=radio name=bil_agr value=0". if ($bil_agr=0) echo 'checked';.">
</td>
</tr>
</table> ";
?> | |
|
|
|
|
|
|
|
для: d-111
(18.06.2006 в 13:36)
| |
<?
$checked1 = ($bil_agr == 1) ? "checked=\"checked\"" : "" ;
$checked2 = ($bil_agr == 0) ? "checked=\"checked\"" : "" ;
$html = "
<table>
<tr>
<td width=40 align=center>
<input type=radio name = bil_agr value = 1 " . $checked1 . ">
</td>
<td width=40 align=center>
<input type=radio name=bil_agr value=0 " . $checked2 . ">
</td>
</tr>
</table> ";
echo $html;
?>
|
| |
|
|
|
|
|
|
|
для: RV
(18.06.2006 в 14:37)
| | Еще можно объединить так
<?
$html = "
<table>
<tr>
<td width=40 align=center>
<input type=radio name = bil_agr value = 1 " .(($bil_agr == 0) ? "checked=\"checked\"" : ""). ">
</td>
<td width=40 align=center>
<input type=radio name=bil_agr value=0 " .(($bil_agr == 0) ? "checked=\"checked\"" : ""). ">
</td>
</tr>
</table> ";
echo $html;
?>
|
| |
|
|
|
|
|
|
|
для: Ziq
(18.06.2006 в 19:32)
| | Огромное спасибо :) | |
|
|
|