Jump to content

Archived

This topic is now archived and is closed to further replies.

djanim8

single line "if statement"

Recommended Posts

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>

Share this post


Link to post
Share on other sites
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>

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.