it would be much easier if you would send the full php file in a zip archive so I can see the full page code in context, without the php file all i can do is guess at things that could be wrong.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.