just looking at the code you posted i can see 2 problems:
1) the add to cart code needs to come after the code for the recordsets
2) you have blank lines between php code blocks that will cause the redirect to fail.
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.