djanim8 Posted August 16, 2006 Share Posted August 16, 2006 I'm getting errors on this line of code:<option value="1" <?PHP if($row["catagoryNum"] == "1") { echo "selected" } ?>>Option 1</option>can you have an if statement on a single line? or do I have to convert it to this:<option value="1" <?PHP if($row["catagoryNum"] == "1") { echo "selected" }?>>Option 1</option> Link to comment https://forums.phpfreaks.com/topic/17763-single-line-if-statement/ Share on other sites More sharing options...
bbaker Posted August 16, 2006 Share Posted August 16, 2006 try adding a space between the >><option value="1" <?PHP if($row["catagoryNum"] == "1") { echo "selected" } ?[color=red]> >[/color]Option 1</option>actually,try adding a ; after "selected"<option value="1" <?PHP if($row["catagoryNum"] == "1") { echo "selected"[color=red];[/color] } ?> >Option 1</option> Link to comment https://forums.phpfreaks.com/topic/17763-single-line-if-statement/#findComment-75817 Share on other sites More sharing options...
ryanlwh Posted August 16, 2006 Share Posted August 16, 2006 it's the ; Link to comment https://forums.phpfreaks.com/topic/17763-single-line-if-statement/#findComment-75959 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.