The code looks correct on these pages. If you give me a URL where I can test and FTP credentials for debugging I can give more information about why it isn't working. It may just be bad credentials.
If you try to check out with authorize.net what happens?
Try creating a blank page and add just this code to it:
Then after a failed transaction go to that page and view the source code. Send me a copy of it in the private area of a response and I can analyze why the payment isn't going through based on the information from the session.