#!/opt/net/GNU/bin/perl use CGI; $query = new CGI; print $query->header; $TITLE="Frameset Example"; # We use the path information to distinguish between calls # to the script to: # (1) create the frameset # (2) create the query form # (3) create the query response $path_info = $query->path_info; # If no path information is provided, then we create # a side-by-side frame set if (!$path_info) { &print_frameset; exit 0; } # If we get here, then we either create the query form # or we create the response. &print_html_header; &print_query if $path_info=~/query/; &print_response if $path_info=~/response/; &print_end; # Create the frameset sub print_frameset { $script_name = $query->script_name; print <$TITLE EOF ; exit 0; } sub print_html_header { print $query->start_html($TITLE); } sub print_end { print qq{


More Examples}; print $query->end_html; } sub print_query { $script_name = $query->script_name; print "

Frameset Query

\n"; print $query->startform(-action=>"$script_name/response",-TARGET=>"response"); print "What's your name? ",$query->textfield('name'); print "

What's the combination?

", $query->checkbox_group(-name=>'words', -values=>['eenie','meenie','minie','moe']); print "

What's your favorite color? ", $query->popup_menu(-name=>'color', -values=>['red','green','blue','chartreuse']), "

"; print $query->submit; print $query->endform; } sub print_response { print "

Frameset Result

\n"; unless ($query->param) { print "No query submitted yet."; return; } print "Your name is ",$query->param(name),"\n"; print "

The keywords are: ",join(", ",$query->param(words)),"\n"; print "

Your favorite color is ",$query->param(color),"\n"; }