- PHP Secure Authentication of User Logins
- Most Used PHP Framework-The Popular Top 7 List in year 2011
- Blogger Robots.txt Tips
- Best Caching Plugin for Wordpress in 2011 is “Quick Cache”
Sample Code Applications
- PHP Secure Login
- Video Streaming PHP Script Tutorial
- Statistical T-Test Online using PHP
- Custom Google XML Sitemap Generator
- Paypal IPN Shopping Page Demo using PHP
- Encrypt PHP code
- Compute Descriptive Statistics using PHP
- Calculate and Estimate Website Authority in Google
- Decimal Random Generator using PHP
- AJAX webform using Prototype library
- Sample AJAX Web Form
- PHP preg_match test online and Function Definition
Sample AJAX Web Form
***Update: January 21, 2010: I recommend you will use the modified AJAX Webform with Recaptcha because this is a more appropriate webform for real applications. The modified webform also reports all validation errors at once.
This type of AJAX implementation in PHP is using the Prototype AJAX library. There are other types of AJAX library which are more popular. A good example is the jQuery AJAX library. An example of a jQuery AJAX web form will be covered in the future tutorials of php-developer.org.
This form will validate your data entry using AJAX. If you are correct with your data entry, the entire information entered will be shown in this page without reloading. The results of the AJAX call to PHP script will be shown below after pressing submit button (in yellow shaded portion).
Related documentation relating to the development of this tool:
Beginner information about using AJAX calls in PHP:
AJAX is one of the great ways you can develop web applications that does not require the page to be reloaded in order to submit form information. Supposing the above information is not using AJAX, what will happen is that after you click the "Submit" button; the form values (name, captcha, etc.) will be submitted to the PHP script (ajaxvalidate.php).
And what will also happen is that after the script validates the form it will return the values back to the browser which you will only see after page has been reloaded or refreshed in the browser.
What are the advantages of AJAX?
1.) It helps user experience by speeding up the form processing and returning the values immediately to them without needing the page to be refreshed.
2.) It is useful particularly if the user experiences a slow connection that also affects the reloading time of the page.
3.) Reloading the page cost a lot of server resources since all the entire HTML and server side elements will be called back to the browser.
Using AJAX saves some of these resources by updating only the required and necessary elements back to the browser instead of the entire elements.
The overview of the AJAX technology used in this example
How to output results from PHP to browser using AJAX?
-Simple, just use the PHP echo command to output whatever you like to be returned back to the browser.
-See the screenshot below for the ouptput script lines in the PHP script for this example:
Download source code