- 论坛徽章:
- 0
|
通过html的表格上的问卷,将填好的内容送到服务器调用enquete.cgi来将数据进行处理,
1.html文件如下:
<html>
<head>
<title>问卷调查</title>
</head>
<body background="./bg1.gif">
<center>
<font size="6" color="green"><b>请协助我们调查</b></font>
<form method="post" action="./enquete.cgi">
<table border="0" cellspacing="10">
<tr>
<td> 名字</td>
<td><input type="text" size="50" name="name"></td>
</tr>
<tr>
<td>邮箱</td>
<td><input type="text" size="50" name="mail"></td>
</tr>
<tr>
<td>性別</td>
<td>
<input type="radio" name="sex" value="男"> 男
<input type="radio" name="sex" value="男"> 女
</td>
</tr>
<tr>
<td>年齢</td>
<td>
<select name="age">
<option value="10岁"> 10岁未满
<option value="10岁年龄层"> 10岁年龄层
<option value="20岁年龄层"> 20岁年龄层
<option value="30岁年龄层"> 30岁年龄层
<option value="40岁年龄层"> 40岁年龄层
<option value="50岁以上"> 50岁以上
</select>
</td>
</tr>
</table>
<p>
谈谈你的感想。(请不要换行)<br>
<textarea rows="6" cols="50" wrap="soft" name="kansou"></textarea>
<p>
<input type="submit" value="送信">
<input type="reset" value="重写">
</form>
</body>
</html>
2.enquete.cgi代码如下:
#!/usr/bin/perl -w
require 'cgi-lib.pl';
&ReadParse(*form);
require 'jcode.pl';
&jcode'convert(*form, 'sjis');
$data = "$form{'name'}\n$form{'mail'}\n$form{'sex'}\n$form{'age'}\n$form{'kansou'}\n\n----------------------\n\n";
open(ENQ, ">>anketo.dat" ) || die "File 'anketo.dat' Open Error: $!\n";
flock(ENQ, 2 );
print ENQ $data;
flock(ENQ, 8 );
close(ENQ);
print "Content-type:text/html\n\n";
print << "end_of_html";
<html>
<head>
<title>あり(~_~)</title>
</head>
<body background="./bg2.gif">
<center>
<b><font size="6">
<font color="red">
<br>
调查问卷内容已经送过来了.
<p>
谢谢你协助我们调查。</font>
<p>
<font color="blue"> (^ o ^)/~</font>
</b>
</center>
</body>
</html>
end_of_html
就这么简单的代码,在mac系统下提示服务出错,
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, you@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log.
大家帮忙指正一下,谢谢.
[ 本帖最后由 sitinl 于 2009-4-15 18:57 编辑 ] |
|