错误如下:

lzj18 2004-08-01 06:40:45
File 'c:\mysql\share\charsets\gb2312.conf' not found (Errcode: 2) Character set '#24' is not a compiled character set and is not specified in the 'c:\mysql\share\charsets\Index' file
Notice: Undefined variable: subject in d:\inetpub\wwwroot\post.php on line 12

发表文章
--------------------------------------------------------------------------------

标题: Notice: Undefined variable: id in d:\inetpub\wwwroot\post.php on line 24

Notice: Undefined variable: subject in d:\inetpub\wwwroot\post.php on line 33
value='' >
姓名: Notice: Undefined variable: author in d:\inetpub\wwwroot\post.php on line 39
>
电子邮件: Notice: Undefined variable: email in d:\inetpub\wwwroot\post.php on line 43
>
文章内容:
<br />
<b>Notice</b>: Undefined variable: contents in <b>d:\inetpub\wwwroot\post.php</b> on line <b>48</b><br />




请勿多次提交,否则您的文章将重复出现。


--------------------------------------------------------------------------------

返回文章列表
...全文
77 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ice_berg16 2004-08-01
  • 打赏
  • 举报
回复
if(($subject=="")||($author=="")||($contents==""))
{
=>
if (!empty($_POST['submit']))
{
extract($_POST);

countstars 2004-08-01
  • 打赏
  • 举报
回复
开头加上
error_reporting(E_ALL^E_NOTICE);
再看看什么错误,你的变量都没有初始化,肯定一堆notice的
wenchaocrazy 2004-08-01
  • 打赏
  • 举报
回复
if($_REQUEST['sumit']="提交"){
$subject=$_POST['subject'];
$author=$_POST['author'];
$contents$_POST['contents'];
if(($subject=="")||($author=="")||($contents=="")){
echo "你没有填写完整";
exit();
}
///////////////////////////////
插入数据库
}
lzj18 2004-08-01
  • 打赏
  • 举报
回复
源代码如下:
<html>
<head>
<title>发表文章</title>
</head>
<body bgcolor="#ffffff" vlink="#e5724f" link="#ff0000" text="2f2f4f">
<?php
//连接数据库服务器,为后面的工作做准备
mysql_connect("127.0.0.1","root","");
mysql_select_db("web_db");

//检查文章信息是否全面,如果不全面,则返回给用户,要求重新填写
if(($subject=="")||($author=="")||($contents==""))
{
?>
<blockquote><blockquote>
<center>
<font size="+2">发表文章</font>
<hr></center>
<form method=post action="post.php">
标题:<input type=text name=subject size=20
<?php
//如果要发表的文章是给别人的回复,则查找原来文章的标题
//在前面添加"Re:"标记,作为新文章的标题
if($id)
{
$query="select subject from guestbook where id='$id'";
$result=mysql_query($query);
if(mysql_num_rows($result))
$arr=mysql_fetch_array($result);
$subject="Re:".$arr['subject'];
}

echo "value='$subject'";
?>
><br>
姓名:<input type=text name=author size=20
<?php
//以下信息如果用户已经填写,则按照原来的内容填写回去
echo $author;
?>><br>
电子邮件:<input type=text name=email size=20
<?php
echo $email;
?>><p>
文章内容:<br>
<?php
echo "<textarea name=contents cols=50 rows=6>";
echo $contents;
echo "</textarea><p>";
?>
<input type=submit value=提交> <input type=reset value=重写>
</form>

<p>请勿多次提交,否则您的文章将重复出现。
<hr>
<center>返回<a href="list.php">文章列表</a><br></center>
</blockquote></blockquote>

<?php
}
else{
//如果用户提交的信息符合条件,则把文章存入数据表中
$date=date("Y-m-d H:i:s");
$query="insert into guestbook values(,'$subject','$author','$email','$date','$contents')";
mysql_query($query);

//如果出错,则报告出错信息;否则,报告成功信息
if(mysql_errno())
{
echo "<center><br><h3>";
echo "您的文章无法写入MySQL数据库,请联系";
echo "<a href='mailto:webmaster@mysite.com'>站长";
echo "</a></h3></center>";
}
else
{
echo "<center><br><h3>祝贺您,您的文章已经成功记录!</h3><br>";
echo "<br><br>返回<a href='list.php'>文章列表</a><br></center>";
}
}
?>
</body>
</html>

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧