Look at the script's output.
If your HTML page is coming out mangled in some way, have a look at the HTML source code the browser is receiving (most browsers will allow you to "View Source" - if you don't have one, get one). Sometimes it's not enough to just look at the rendered page.
All too often people post problems like "I want to print [stuff] on different lines but it all comes out on one line." or "my form variables are getting shortened". If these people viewed the source they'd probably see things like
I think I shall never see
An HTML page as pretty as me
("Oh, yes, that's right. HTML replaces line breaks with spaces. I need to turn those into <br> tags. That's [man]nl2br[/man].")
<input type=text value=First name last name=bunchawords>
("Ah, now I know why I'm supposed to quote my tag attribute values. How else is the browser supposed to know where the value ends and the next attribute begins?")
You might also find things like mislaid tags, discover that something that should have been inside a loop wasn't or vice versa, text HTML characters like < and > inside select options or textareas being mistaken for HTML (this is even easier in a browser that does sytnax highlighting in its view source window), and so on. (This last one happened to me today; HTML had accidentally got into the database and whenever that database field was printed out, the page went odd.)