Post the errors you are getting and what behavior the application is doing and what it's suppose to be doing.

Take a look at the scope of variables.