O'Reilly logo

PHP for Teens by Maneesh Sethi

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

Advanced Elements

Get ready—I go over a lot of different form elements in this chapter.

Radio Buttons

Radio buttons are organized into groups: Only one in a group of radio buttons can be selected. Use the <input> tag with the type set to radio (the same way that you do with a checkbox). However, you need to add one more parameter in addition to type and name: value. This parameter becomes the value of the $_GET or $_POST array that you access through PHP. For items of the same group, all of their name parameters are identical. This becomes the key of the GET or POST array.

It’s important to note that a key/value pair is only sent if at least one of the radio buttons is selected. For this reason, if you decide to not make one of the radio buttons ...

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