Quote:I am able to insert data in the database in the view below
What do you mean? I don't see any database actions inside your view. In fact, that's good news, because database operations don't belong inside views. That's what models are for.
Please, explain how your view interacts with the controller, and if you have a model for saving stuff into your database.