Creating an HTML select element generator
Generating an HTML single select element is similar to the process of generating radio buttons. The tags are structured differently, however, in that both a SELECT
tag and a series of OPTION
tags need to be generated.
How to do it...
- First of all, create a new
Application\Form\Element\Select
class that extendsApplication\Form\Generic
. - The reason why we extend
Generic
rather thanRadio
is because the structuring of the element is entirely different:namespace Application\Form\Element; use Application\Form\Generic; class Select extends Generic { // code }
- The class constants and properties will only need to add slightly to
Application\Form\Generic
. Unlike radio buttons or checkboxes, there is no need to account ...
Get PHP 7: Real World Application Development 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.