O'Reilly logo

Core PHP Programming: Using PHP to Build Dynamic Web Sites by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Passing Arrays in Forms

Though it may not be apparent, it is possible to pass arrays from a form. To understand how, you must recall how form fields are turned into PHP variables. Each field is read in order by PHP and turned into an assignment statement. A URL like http://www.somesite.com/script.php3?name=leon creates an assignment like $name = "leon", which means that before the script begins executing, the name variable is set.

The name of the form field is treated as the left side of an assignment statement. This means that if other special characters appear as part of the name of the field, they will interpreted accordingly. You can include square brackets to force the variable to be an array. An empty pair of square brackets will add a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required