This article will touch on two skills in the interface between PHP and HTML forms, specifically in working with hidden fields, and as a bonus, in passing arrays in an HTML form.
Another very good, and very easy way to use PHP to do something that is more complicated in other languages is form processing and sending e-mail. PHP makes it easy for even the most neolithic of us. This two-page tutorial shows you how.
Platform(s): Linux, Windows, FreeBSD, Mac OSX, Sun Solaris
In this part four of a series on HTML form handling with PHP, it explains how to create a powerful PHP form handler, called Phorm Manager. Topics include: Design goals, Internal data management, form validation, and more. Full source code available.
If your PHP program is a dynamic web page (and it probably is) and your PHP program is dealing with user input (and it probably is), then you need to work with HTML forms.
Tips for simplifying, securing, and organizing your form-handling PHP code.
The validation of data that has been entered in a form is necessary in most cases. Why is important? For example, what good is holding a contest or sweepstakes if you can't notify the winner, because he or she entered an invalid telephone number or an incorrect address. What good is having a mailing list if the e-mail addresses on it aren't verified, and your mailing list just bounces back to you without reaching the subscribers and target audience.<br /><br />
Validating form entries saves you time and more importantly, it can save you money. And since somebody embossed the slogan "Time is money!", this should be very important for your web site!<br /><br />
Well when should we validate? There are two types of validation; client side and server side.
A collection of 21 tips on process Web forms with PHP scripts. Clear explanations and tutorial exercises are provided on generating and processing Web forms, getting values out of $_REQUEST, processing multiple choices, removing slashes, adding multiple submit buttons, adding hidden values, processing original query string:
How To Retrieve the Submitted Form Data?
How To List All Values of Submitted Fields?
How To Retrieve Input Values for Checkboxes Properly?
How To Remove Slashes on Submitted Input Values?
How To Support Multiple Submit Buttons?
How To Support Hidden Form Fields?
How To Retrieve the Original Query String?
How To Protect Special Characters in Query String?
...
Platform(s): Linux, Windows, FreeBSD, Mac OSX, Sun Solaris
Using PHP array functions to view all of your POST/GET Variables make it easy for retrieving data from online forms. It's also great for debugging your codes.