Document Home
Previous: An Integrated Dynamic Environment
get_form subroutine
store subroutine

The sel_form Subroutine


sub sel_form {

print header("text/html"),
('<html>');
print ("<H1>Entry Form Configuration</H1>");
print ("Select the number of forms you wish to display on a page");
print ("<p><form>");
print ("<input type='radio' name='num_forms' value='3'>Three - (640x480)<input type='radio' name='num_forms' value='5'>Five - (800x600)<br>");
print ("<input type='radio' name='num_forms' value='4'>Four - (800x600)<input type='radio' name='num_forms' value='8'>Eight - (1024x768 or higher)<p>");
print submit(-name=>"submit",-value=>"enter");
print $forms->hidden("action","enter");
print endform;
print end_html;



}

This is a straightforward little subroutine that simply generates a page comprised primarily of a radio-button selection box that is used to select the number of forms to display on a given page. In general, it simply directs html back to the browser ... if you've been paying attention in previous sections (and I know you have) most of this should look pretty familiar to you. The only new thing in this subroutine is the use of the hidden field near the very end of the form. Hidden fields are on an invisible widget within your browser environment. Yeah, I know that sounds kind of weird, but the use of hidden fields is one of the primary methods for maintaining state between invocations of a script. In effect, what the script on the web server is doing is sending information to the browser environment that can be returned to the web server as part of whatever the browser asks for next. In this situation, the hidden field stores the information that will be returned to the script to determine what will be executed when the current form on the browser is submitted. As an aside, there is a type of utility much in vogue on the internet called ad blockers or pop-up stoppers. I use one, you may as well. While these can block many annoying advertisements, poor configuration of a utility like this can also block the widgets carrying hidden fields, thus interfering with the coherent functioning of a given site.