Search code examples
htmlnetbeanssyntaxtagshighlighting

Netbeans incorrectly highlighting html opening/closing tags in php script


<form name='toggleAutoManual' action='action' onchange='this.submit()'>
<input type='hidden' name='formSubmit' value='true'>
Mode: 
<?php  

if ($autoFlag==1)
{
    ?>
<input type='radio' value='Auto' checked='checked' name='autoFlag'>Auto / <input type='radio' value='Manual' name='autoFlag'>Manual
<?php
}
else
{
 ?>
<input type='radio' value='Auto' name='autoFlag'>Auto / <input type='radio' value='Manual' checked='checked' name='autoFlag'>Manual
<?php
}
?>
</form>


the above snippet uses php to check a variable, and based on that checks either the "auto" or "manual" checkbox. My question is about how netbeans highlights the syntax. When you click an opening html tag in netbeans, it highlights it yellow, and also the closing tag yellow. A tag is highlighted in red if it cannot find a closing tag. My "form" tags get highlighted in red. This really bugs me. This error happens several times throughout my script, on a number of different tags. Am I doing something wrong here? Any idea why this is happening? Thanks!


Solution

  • Tha's not how you should use your tags, rather use something like this:

    <form name='toggleAutoManual' action='action' onchange='this.submit()'>
    <input type='hidden' name='formSubmit' value='true' />
    Mode: 
    <?php  
    if ($autoFlag==1){
    echo "<input type='radio' value='Auto' checked='checked' name='autoFlag' />Auto / <input type='radio' value='Manual' name='autoFlag' />Manual";
    }else{
     echo "<input type='radio' value='Auto' name='autoFlag' />Auto / <input type='radio' value='Manual' checked='checked' name='autoFlag' />Manual";
    }
    ?>
    </form>
    

    This should fix your problems