The code looks like it would work to me.
I'd need to debug the page to figure out why. I'd add code after line 279:
That would show me the insert statements and any errors. Then after line 283 I'd add:
That would prevent the redirect to the success page so I could look at the errors to try to figure out what went wrong.