My html 4.01 form won't valid... why so?

My html 4.01 strict form won’t validate…

    <div class="hd">
          <form action="viewall.php">
           <input id="viewall" type="submit" value="VIEW ALL">
          <input type="hidden" name="name" value="<?php

echo $name; ?>">
</form>
</div>

Line 83, Column 66: document type does not allow element “INPUT” here; missing one of “P”, “H1”, “H2”, “H3”, “H4”, “H5”, “H6”, “PRE”, “DIV”, “ADDRESS” start-tag

Do submit buttons and hidden elements have to be wrapped in their own DIV or P tags?

yup :slight_smile:

not each one individually, but at least within one DIV or P within the form

Rudy, I’m on chapter 4 of your Simply Sql book… and I was going through the examples just a few hours ago. It’s a great book. Thanks for the reply. It really changed the way I program sites. I use the database a lot more, than just having php do all the work.

thanks for the kind words, it’s very nice to get such positive feedback

:slight_smile:

There are certain HTML elements that, if you go through the specs, require a block element as an immediate child.

On most forms, that block (or blocks) would be a fieldset. A fieldset gets a legend.

Usually I’d rather see fieldsets in forms than p’s.

On very short forms like login or search, a div may do the job better and no hassle for a legend that, on forms like that, don’t necessarily add anything useful.

Other blocks like this (who require blocks as direct children) are the body and blockquote.