Posted by Sandman on 10/09/06 09:05
In article <1160384144.408791.288410@m73g2000cwd.googlegroups.com>,
"elia" <joseph@pcl.ch> wrote:
> Hello,
>
> I would like to show a line in a tabel in html if there is quantity of
> article choosed.
>
> My code is:
>
> <? if ($quantite1 > 0) {
> echo('
> <tr>
> <td align="left" nowrap="nowrap">Article 1</td>
> <td align="center"><? echo $quantite1 ?> </td>
> <td align="center">20 €</td>
> <td align="center"> <? echo $montant1 ?> €</td>
> </tr>');
> }
> else{
> echo("");
> }
> ?>
>
> If there is no article >> no line
> If there is article >> show the line
>
> Problem: I can have the variable $quantite1 and $montant1 en php
You can't break into php code inside a echo.
Try:
echo "<td> $montant1 </td>";
And not:
echo('<td> <? echo $montant1 ?> </td>');
^ ^
1 2
1. Using ' means that variables won't be parsed, but printed.
2. <? ... ?> is for the parsing engine, not to be used within PHP code.
--
Sandman[.net]
[Back to original message]
|