Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic code will not validate. 2

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
Some basic code but with a number of errors.
What am I missing here?
It works fine without the table code but I am intrigued with what is wrong here.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<head>
<title>Title</title>
</head>
<body>
<form method='post' action='script.pl'>
<table>
<input type='hidden' name='call' value='resend'>
<tr><td>Your Name</td><td><input type='text' name='CONTACT' value=''></td></tr>
<tr><td>Email Address</td><td><input type='text' name='EMAIL' value=''></td></tr>
<tr><td colspan='2'><input type='submit' NAME='submit' value='Please Email My Log in Details'></td></tr>
</table>
</form>
</body>
</html>



Keith
 
Hi Keith,
Firefox web developer tool validator results showed no charset specified, so I put one in and then I just placed your hidden input type in a tr in the table and then bingo it validated. Don't know why it was failing though!!

See code below
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Title</title>
</head>
<body>
<form method='post' action='script.pl'>
<table>
<tr><td><input type='hidden' name='call' value='resend'><tr><td>
<tr><td>Your Name</td><td><input type='text' name='CONTACT' value=''></td></tr>
<tr><td>Email Address</td><td><input type='text' name='EMAIL' value=''></td></tr>
<tr><td colspan='2'><input type='submit' NAME='submit' value='Please Email My Log in Details'></td></tr>
</table>
</form>
</body>
</html>

Steve
 
Hi Keith,
Ooops, minor correction to my code. I didn't close my tr and td tags correctly. Code below has been corrected and it still validates.

After a short Google session it would appear that any content outside of table tags ( tr, td etc ) will not validate as content should appear inside table tags. It still displays in a browser though.

Anyway, hope this helps

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Title</title>
</head>
<body>
<form method='post' action='script.pl'>
<table>
<tr><td><input type='hidden' name='call' value='resend'></td></tr>
<tr><td>Your Name</td><td><input type='text' name='CONTACT' value=''></td></tr>
<tr><td>Email Address</td><td><input type='text' name='EMAIL' value=''></td></tr>
<tr><td colspan='2'><input type='submit' NAME='submit' value='Please Email My Log in Details'></td></tr>
</table>
</form>
</body>
</html>

Regards

Steve
 
Thanks Steve
I think there must be something corrupted in my original file.
Pasting my original code, from the code box above, into a HTML page - does not validate.
The code you returned, even with the charset line removed, does validate.
All is working now thanks.


Keith
 
The main reason your code does not validate is your hidden input.

There can be nothing between <table> tags if its not also contained between <tr> and <td> tags.
i.e. your hidden input is misplaced, and causes the rest of the validation errors.

Remove it, and your code will validate as is.

Code:
<table>
[b][COLOR=#A40000]<input type='hidden' name='call' value='resend'>[/color][/b]
<tr><td>Your Name</td><td><input type='text' name='CONTACT' value=''></td></tr>
<tr><td>Email Address</td><td><input type='text' name='EMAIL' value=''></td></tr>
<tr><td colspan='2'><input type='submit' NAME='submit' value='Please Email My Log in Details'></td></tr>
</table>

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top