Page 1 of 1
Shoul this code work or is just sh%t?
Posted: Fri Dec 12, 2003 7:11 am
by Perfidus
I want PHP to write a radio button only if condition is ok, but I do not what I'm doing wrong because I´m getting an error:
Code: Select all
<?
if ($row['ene1d']!=0)
{
echo"<input type='radio' name='ene1t' value='"
.$valor1=$row["ene1"]; $ene1t=$valor1+(($valor1*10)/100)+((($valor1*10)/100)*16/100); echo round($ene1t);.
"'>";
}
?>
Posted: Fri Dec 12, 2003 7:52 am
by JayBird
what error you getting?
Posted: Fri Dec 12, 2003 7:55 am
by JayBird
i can see that your code is wrong - quite wrong actually - what you trying to do?
Mark
Posted: Fri Dec 12, 2003 8:09 am
by twigletmac
I really don't see the benefit of trying to cram so many lines of code (as deliminated by the ;'s) onto one. When you start separating them out your code becomes easier to debug, and you may find the problem more apparent:
Code: Select all
if ($row['ene1d']!=0)
{
echo '<input type="radio" name="ene1t" value="'.$valor1=$row['ene1'];
$ene1t = $valor1 + (($valor1*10)/100) + ((($valor1*10) / 100) * 16 / 100);
echo round($ene1t);
."'>";
}
That's the code broken up - can you see the problems now?
Note to others - give the guy a chance to figure it out himself pretty please.
Mac
Posted: Fri Dec 12, 2003 9:22 am
by Nay
twigletmac wrote:Note to others - give the guy a chance to figure it out himself pretty please.
Mac
The Mac has spoken, resistance is futile!
-Nay