This PHP function is ever-so-helpful. I use it for quickly, easily, and safely reading information from user input on web pages in either GET or POST submissions. It allows you to limit how much information they can feed back to you and also contains a regex filter capability so you can say “they can only submit information of such-and-such format.”

Get no more than 40 characters from the user supplied HTML field:
$userfield = request(“formfieldname”, 40, “/^\w+$/”);

Get any number of bytes (any type of data) from the user supplied HTML field:
$userfield = request(“formfieldname”);



Leave a Reply

Your email address will not be published. Required fields are marked *