我正在尝试使用 perl 脚本将 html 中的数据填充到 DBD 数据库中。
这是我的html代码:
<html>
</head>
<body>
<H1>Friend's contact book</H1>
<FORM ACTION="contact.pl" METHOD="POST">
<HR>
<H2>Friend's contact</H2>
<PRE>
Name:<INPUT TYPE="text" NAME="name">
Address:<INPUT TYPE="text" NAME="add">
</PRE>
</HR><P>
<INPUT TYPE="submit" VALUE="Sign Up"> or <INPUT TYPE="reset" VALUE="Cancel">
</P>
</FORM>
</body></html>
这是我的 perl 脚本:contact.pl
#!/usr/bin/perl
# Initialize DBI.
use DBI;
use strict;
# Make the database connection.
my $dbh = DBI->connect("dbi:Pg:dbname=friendcontact")
or die my $DBI::errstr;
# Store the SQL query
myy $stat = my $dbh->prepare("INSERT into friend (name, add) VALUE
(?,?)");
# Execute the query
my $stmh->execute();
# Tidy up
my $stmh->finish();
my $dbh->commit or die my $DBI::errstr;
我无法运行contact.pl代码它说“内部服务器错误”
无论如何我可以纠正这个吗?
非常感谢提前
谢谢我已经按照您的说法编辑了代码,但是更新后出现错误: 内部服务器错误
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.
Premature end of script headers: /home/friendcontact/private/cgi-bin/contact.pl