If you post your complete code and want someone would debug your code and find issues and fix it. It is asking for too much. You need to make your question concise and make it easy for anybody to help.