- 论坛徽章:
- 0
|
软件环境:WindowsXP,Activeperl5.8,Apache2.2.6
apply.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" c />
<title>申请页面</title>
</head>
<body>
<p align="center"><font face="宋体" size="6">申请页面</font></p>
<form action="http://127.0.0.1/cgi-bin/apply.pl" method="post">
<p>请填写申请</p>
<p>你的姓名:<input type="text" name="name" size="20"></p>
<p>你的性别:<input type="radio" value="male" checked name="sex">男 <input type="radio" value="female" name="sex">女</p>
<p>你的受教育程度:
<select name="education" size="1">
<option value="gaozhong">高中</option>
<option value="dazhuan">大专</option>
<option value="benke">本科</option>
<option value="shuoshi">硕士</option>
<option value="boshi">博士</option>
</select>
</p>
<p>你的兴趣与爱好:<input type="checkbox" name="lvyou" value="on">旅游 <input type="checkbox" name="tiyu" value="on">体育 </p>
<p><input type="submit" value="提交" name="B1"> <input type="reset" value="重新输入" name="B2"></p>
</form>
</body>
</html>
apply.pl:
#!/perl/bin/perl
use strict;
my %input=readInput();
print <<"EOF";
content-type:text/html\n
<html>
<body>
浏览器发送的数据为:$input{'data'} <br>
解析后的数据是:<br>
EOF
foreach(keys %input)
{print "你输入的$_值为:$input{$_} <br>" unless($_ eq 'data');}
print "</body></html>";
#########################################################################
sub readInput()
#########################################################################
{my(%field,$in,$name,$value,@pairs);
if ($ENV{'REQUEST_METHOD'} eq 'POST')
{read(STDIN,$in,$ENV{'CONTENT_LENGTH'});}
elsif ($ENV{'REQUEST_METHOD'} eq 'GET')
{$in=$ENV{'QUERY_STRING'};}
else {return undef;}
$field{'data'}=$in;
@pairs=split(/&/,$in);
foreach (@pairs)
{$_ = ~s/\+//g;
($name,$value)=split(/=/,$_);
$value=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eq;
$name=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eq;
$field{$name}=$value;
}
return(%field);
错误:
执行http://127.0.0.1/apply.html应该执行apply.pl
却显示:
Internal Server ErrorThe server encountered an internal error ormisconfiguration and was unable to completeyour request.
Please contact the server administrator, root@superman.com and inform them of the time the error occurred,and anything you might have done that may havecaused the error.
More information about this error may be availablein the server error log.
那位高手给看看哪错了?????谢谢!
httpd.conf在附件中 |
|