I've been working on a registration form page in j Query Mobile and I think I'm starting to get it fully complete.What I need feedback on is if I've forgotten anything in terms of accessibility, security (am I open to any SQL injections or other risks? It's my first time creating a proper registration form like this so surely there must be things to improve.The validation of each field is done by objects inheriting from the Figure 2-3 shows the code that is executed during the interaction between the application and the user.Figure 2-3 - Code executed during the Interaction between the Application and the User You might have noticed that during the redirection to the thank you page, we are not using method is in fact returning the validated and cleaned data.A DB-Error will make your application useless therefore you want it to reach the main try catch block of your application, in which you should handle the error.You use a global variable for storing your DB connection, better use a singleton object. Using a singleton with lazy initializing will reduce load time on pages that do not interact with the DB and will create cleaner code. Send your form to the controller and let it process the users input.
While you are correct that it is important to handle errors, this is not the right place to do it.Each field can be identified by a unique name as we observed in Chapter 1.We connected a widget to each field in order to display it to the user, now let's see how we can apply validation rules to each of the fields.* * @param String $usertype * The type of user, for example teacher. * * @param String $password * The users password in clear text.* * @param String $confirmed_password * The repeated input of the users password in clear text.In these cases, we would like to display error messages to ask the user to correct the input, as shown in Figure 2-1.