7.8. Form Widget Methods

The here document, though handy, may not be the best way to build every HTML page. CGI.pm provides several other methods to create widgets, including:

  • start_form()— start tag for the form

  • textfield()— tag for a text widget

  • textarea()— tag for a text area

  • radio_group()— tags for a radio button group

  • checkbox()— tag for a check box

  • popup_menu()— tag for a pop-up menu

  • scrolling_list()— tags for a scrolling list box

  • submit()— tag for a submit button

  • reset()— tag for a reset button

  • end_form()</FORM>

The following example, /var/www/cgi-bin/widgets3.cgi, uses these methods and produces the same form shown in Figure 7.12. You can find its code at http://localhost/cgi/widgets3.cgi or www.opensourcewebbook.com/cgi/widgets3.cgi ...

Get Open Source Web Development with LAMP: Using Linux, Apache, MySQL, Perl, and PHP 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.