在 cgi-bin目录下的文件greeting.pl文件内容:
#!perl -w use CGI qw/:standard/; { my $cgi= new CGI; print $cgi->header,$cgi->start_html('A Simple Example'),$cgi->h1('A Simple Example'); if ( $cgi->param()) { print "Your name is ",$cgi->param('name'); } $cgi->end_html(); }
在htdoc目录下文件begin.html文件内容:
<HTML> <HEAD><TITLE>Testing a Form</TITLE></HEAD> <BODY> <H1>Testing a Form</H1> <HR> <FORM ACTION="/cgi-bin/greeting.pl" METHOD="POST"> Enter your full name: <INPUT TYPE="text" NAME="name" SIZE=60><BR> <P> <INPUT TYPE="submit" VALUE="Submit the form"> <INPUT TYPE="reset" VALUE="Clear all fields"> </FORM> <HR> </BODY> </HTML>
3.运行查看
打开静态界面,输入点击,提交按钮
网页自动转到