How do I include a frameset under CGI.pm?
Posted
by neversaint
on Stack Overflow
See other posts from Stack Overflow
or by neversaint
Published on 2010-04-23T09:02:13Z
Indexed on
2010/04/24
9:43 UTC
Read the original article
Hit count: 278
I want to have a cgi-script that does two things.
- Take the input from a form.
- Generate results base on the input values on a frame.
I also want the frame to exist only after the result is generated/printed.
Below is the simplified code of what I want to do. But somehow it doesn't work. What's the right way to do it?
#!/usr/local/bin/perl
use CGI ':standard';
print header;
print start_html('A Simple Example'),
h1('A Simple Example'),
start_form,
"What's your name? ",textfield('name'),
p,
"What's the combination?",
p,
checkbox_group(-name=>'words',
-values=>['eenie','meenie','minie','moe'],
-defaults=>['eenie','minie']),
p,
"What's your favorite color? ",
popup_menu(-name=>'color',
-values=>['red','green','blue','chartreuse']),
p,
submit,
end_form,
hr;
if (param()) {
# begin create the frame
print <<EOF;
<html><head><title>$TITLE</title></head>
<frameset rows="10,90">
<frame src="$script_name/query" name="query">
<frame src="$script_name/response" name="response">
</frameset>
EOF
# Finish creating frame
print
"Your name is: ",em(param('name')),
p,
"The keywords are: ",em(join(", ",param('words'))),
p,
"Your favorite color is: ",em(param('color')),
hr;
}
print end_html;
© Stack Overflow or respective owner