Getting Input from Forms

Sending text to the browser is easy to understand. Getting input from forms is a little tricky. HTML offers several ways to get information from the user via forms. There are text fields, text areas, selection lists, and radio buttons among others. Each of these becomes a string of text offered to the Web server when the user clicks the submit button.

When a form is submitted, PHP turns each form field into a variable. The variables created this way are like any other variable. You may even change their values. They are created as if you had written the PHP code to put values into the variables. This means that if you put two form variables on a page with the same name, the second one may overwrite the value of the first. ...

Get Core PHP Programming: Using PHP to Build Dynamic Web Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.