Building a successful web page that shows a confirmation message to the user when the previous contact web form has been submitted correctly is an extremely simple process. You'll surely grasp it in a snap. Below I listed the complete signature for this successful view, so you can see clearly how it works. Here it is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>User data submitted successfully!</title> </head> <body> <h1>User data submitted successfully!</h1> <p><?php echo anchor('validator','Go and submit the form again');?></p> </form> </body> </html> That was really simple to code and read, wasn’t it? In this particular case, the above view file will display a typical confirmation message once the pertaining web form has been submitted correctly. Of course, the only detail to stress here is the use of the URL helper function loaded previously by the corresponding controller, which dynamically generates an anchor tag that points to the controller’s location, in case a user wants to submit the online form again. Finally, save this new view file to the Code Igniter /system/application/views/ folder, as you did with in the example developed in the previous section, and test the application by typing into your browser’s address field the following URL: http://localhost/codeigniter/index.php/validator/ You’ll be amazed at how sweetly the previous example works! At this point I explained how to build a basic web application that uses the validation class bundled with Code Igniter to check whether or not the fields of a sample web form have been filled. Indeed, you shouldn’t have major problems understanding how this application works, but naturally you can fill some gaps on this topic by examining all of the code samples included in this tutorial. Final thoughts In this fourth episode of the series, you hopefully learned how to employ the validation class that comes included with Code Igniter to perform a basic validation on a simple online contact form. In the forthcoming article, I’m going to show you how to perform strict validation on the data entered into a sample web form. So, now that you’ve been warned of the topics that will be discussed in the next tutorial, you don’t have any excuses to miss it!
blog comments powered by Disqus |
|
|
|
|
|
|
|