Validation problems with auto-inserted input

J

Jonathan

I am pasting some code below that I am having a lot of trouble with. I
have a php guestbook page that I'm trying to validate, and I keep
getting an error stating that I can't have a certain "input" element in
a location in which I am not actually attempting to place one at all. I
have tried to enclose all other input elements in blocks of "td" tags,
which has worked for the most part, but because this particular input
element seems to be dynamically generated, I can't figure out what I
ought to do to prevent it from producing this kind of error.




Here's the error code:

Error Line 71 column 153: document type does not allow element "input"
here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div",
"pre", "address", "fieldset", "ins", "del" start-tag.

....="fa4a5c7b4eab7d80abb333272ea9d308" /><table
style="width:100%;"><tr><td cols





Here is the PHP code in which this is actually occuring (I've verified
that this is where it's occurring by making minute changes and
re-viewing a validation check):

print "<form method=\"post\"
action='guestbook.php?guestbook=$guestbook;'>";
[auto-insert of input element seems to be occurring here]
print "<table style=\"width:100%;\">";
....
print "</table>";




So, my question is, since I know there may not be a lot I can do to
prevent the auto-insertion, does anyone have any suggestions on how I
might code around such an expected auto-insertion of an input element?
This is the only page on which I've had this problem, even though my
(much more complicated) weblog page validates perfectly (with the
exception of my web host's auto-inserted raw ampersands in the URL
links), and that page contains even more forms that are built in a
virtually identical fashion.

If anybody has any suggestions, that would be great.

Thanks,

Jon
 
M

Mitja Trampus

Jonathan said:
Error Line 71 column 153: document type does not allow element "input"
here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div",
"pre", "address", "fieldset", "ins", "del" start-tag.

PHP:
print "<form method=\"post\"
action='guestbook.php?guestbook=$guestbook;'>";
[auto-insert of input element seems to be occurring here]
print "<table style=\"width:100%;\">";
...
print "</table>";[/QUOTE]

What the validator is saying is you can't have form elements
directly inside a form. So
<form> <input> </form>
is wrong while
<form> <p> <input> </p> </form>
or
<form> <div> <input> </div> </form>
is fine (that's the "missing one of..." part of the error msg).
 
J

Jonathan

Right. I understand that the error is appearing because an input
element is appearing inside of the form, however I don't know how to
solve the problem of having that input element there in raw form, since
it's being automatically inserted (i.e. I'm not coding it, it's just
appearing... in fact I can't even see it when I view the source code
myself, but the w3c.org validator seems to be finding a input item
inserted there to contain my session id). So I don't know how to embed
it in the proper tag sets if it's being auto-inserted right after my
opening form tag. This may be something I need to post in a PHP forum.
 
N

Neredbojias

With neither quill nor qualm, Jonathan quothed:
That solved it. Thanks so much!

- Jon

I'm so happy for you! While you are prancing upon the loam of your new-
found knowledge, the rest of us suckers are wallowing in the muck of our
ignorance. Thanks for nothing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top