我想要一個可以做兩件事的cgi腳本。如何在CGI.pm下包含框架集?
- 從窗體中獲取輸入。
- 根據幀上的輸入值生成結果。
我也希望幀存在只有結果生成/打印後。
下面是我想要做的簡化代碼。但不知何故,它不起作用。 什麼是正確的做法?
#!/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;
謝謝,@ DJTripleThreat,但這不是關於點(我已經足夠了)。我只是想知道如果我錯了。 – 2010-04-28 09:47:01
http://meta.stackexchange.com/questions/22934/so-annoyed-with-no-comment-vindictive-downvoting – 2010-04-29 14:23:21