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
This set of functions allows you to use simple PHP commands to generate complex forms containing many different inputs. It automatically outputs the HTML code for the form and makes it easy for you to process the input when the form is submitted.
Every now and then for some reason a user will feel compelled to send a message to a webmaster. By using a form this makes the process much easier from both points of view. The user does not have to search for an e-mail address and open an e-mail client, and the webmaster is presented with a relatively well formatted message.
Checkboxes in web forms are useful because they allow the person filling out the form to choose from a wide range of possible choices. Specifically, it allows the user to choose some, all or none of the elements. Although checkboxes are excellent form elements for certain tasks, there is often confusion about how to store checkbox data correctly. This article will demonstrate how to store checkbox data in a database, in a manner that follows good database design principles.
Learn how to create an expandable Form Validation Class using PHP's object oriented features that once complete, can be easily customized and expanded to suit your needs in the future with no changes to the base code. The Class will able to validate everything from Email Address, Passwords, User Names, Domain Names, Credit Cards, Numbers, Strings, HTML, Etc. Very detailed with extensive code segments to guide you every step of the way.
This is an illustration of how to send email through PHP. I did not create a function because I feel mail() is already a wrapper all by itself. I left the first parameter empty because I feel that the "to row" is not any more important than any other row in the header string.
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.