html validation error while using input type= hidden

I keep getting an error message when trying to validate my coding for this form. Could someone run their eyes over it and see if you can pick up on something I haven't.

The error is coming from this line in my coding:

<?php if ($ContactID != '') { ?>
<input type="hidden" name="ContactID" value="<?php echo $ContactID ?>"/>
<?php } ?>

Actual coding:

<!-- Form-->
<form name="editcontact" method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>"> 
<table border="1" cellpadding="2">
<caption>Edit Contact</caption>

<!--ID Input-->

<?php if ($ContactID != '') { ?>
<input type="hidden" name="ContactID" value="<?php echo $ContactID ?>"/>
<?php } ?>



<!--Name Input-->
<tr>
<td><label for="Name">Name</label></td>
<td><input type="text" name="Name" value="<?php echo $Name ?>" size="30" maxlength="50" tabindex="1"/>
</td>
</tr>


</table>
</form>

Answers


input isn't a valid child of the table element. Your provided code will render:

<table>
    <input type="hidden" ... >
    ...
</table>

You should either wrap this hidden input field within a td or th element, or move it outside of the table completely:

<table>
    <tbody>
        <tr>
            <td>
                <input type="hidden" ... >
            </td>
        </tr>
        ...
    </tbody>
</table>

Or:

<input type="hidden" ... >
<table>
    ...
</table>

Need Your Help

Jenkins can't check parameters testng

maven jenkins testng

I'm trying to build my test in jenkins with testng. So I configured a testng.xml file that can run my tests

JSON to JS with Django: SyntaxError: missing : after property id

javascript python json django

I'm attempting to get a JSON file into a script. I can't seem to be able to get it there by serving it from the filesystem so I made a view that returns the JSON data to the page like so: