PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Perfidus
Forum Contributor
Posts: 114 Joined: Sun Nov 02, 2003 9:54 pm
Post
by Perfidus » Fri Dec 12, 2003 7:11 am
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);.
"'>";
}
?>
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Fri Dec 12, 2003 7:52 am
what error you getting?
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Fri Dec 12, 2003 7:55 am
i can see that your code is wrong - quite wrong actually - what you trying to do?
Mark
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Fri Dec 12, 2003 8:09 am
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
Nay
Forum Regular
Posts: 951 Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia
Post
by Nay » Fri Dec 12, 2003 9:22 am
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