I haven't had time to look at the code closely, but one thing I would say is to not use "title" as the name of a form field. It's a reserved keyword in HTML and may cause confusion.
If you print out the value of the "title" field (as a diagnostic), what does it output?