Welcome to WebmasterWorld Guest from 184.108.40.206
I would say run it through a code validator and stay up all night trying to see what went wrong. Any other ideas out there in the trenches?
There are going to be times when our pages don't work (or, some cases, you won't see any result.) Post your list of 5 to 10 troubleshooting recommendations.
Use a valid document type. Although this doesn't insure perfect cross-browser compatibility, it certainly reduces those problems to a minimum.
Use an appropriate document type. Nearly every new page I see is an XHTML doctype. When asked why they chose this, the answer is invariably "Because it's the latest technology." Then you go on to see deprecated elements uses such as <center> and <font> (UGH!) which tells me they have no clue about the selected doctype. It was predicted that XHTML would replace HTML. This is not the case, HTML 5 is being finalized.
XHTML has specific applications, and unless you are actually using those applications and your server is actually serving up the text/xhtml content type, you are making things more difficult for yourself and should be using an HTML doctype. If you don't understand what I just said, all the more reason to NOT use an XHTML doctype.
Both discussed at length here [webmasterworld.com]
Validate your code. W3C validator [validator.w3.org]
Process of elimination. If your code is valid, it's a valid document type, and it's still broken, begin by saving a test file, then cutting out all extraneous elements in the CSS and html, and preview the page in chunks. Put borders on all your elements so you can see what they are up to. Quite often it's the combination of only one or two simple elements that are bringing the whole page down, and this is the fastest way to find them.
Use as many tools as you can understand. By this I mean that FireFox has literally hundreds of plug ins available to help you understand "what's going on" in a number of situations. Some of them are so robust it takes a manual to make use of them, some of them are simple and will accelerate your project and learning curve. Some examples are Live Headers, FireBug, Dust-Me (which locates unused CSS selectors) And YSlow, for example.
I will add, although it validates, always quote all attributes. This is not a troubleshooting tip, but it always helps to be as right as possible.
Once you know HTML, you can look at the source code and the problem could be an obvious flaw in the code, easily fixed in Notepad.
Baruch: This is the first I've heard of document.write and echo variable...but, I'll definitely look in to it. Thank you.