不给出代码谁知道什么原因??按你所给出的条件,也只能推断大概是提交表单的HTML代码出错了~~

解决方案 »

  1.   

    <?
    if($action == "&ETH;&acute;&ordm;&Atilde;&Aacute;&Euml;!")
    {
    if( $name == " " || $msg ==" " )
    {
    //------------[ 1]
    echo"<html>\n";
    echo"<head>\n";
    echo"<title>&sup3;&ouml;&acute;í&Aacute;&Euml;</title>\n";
    echo"</head>\n";
    echo"<body bgcolor=#ffcc99><center>\n";
    echo"<h1>出错了</h1>\n";
    echo"<p><font color = red>信息不全!昵称和内容是必须填写的!</font></p>\n";
    echo"<a href=\"javascript:history.go(-1)\">请重试</a>\n";
    echo"</center></body>\n";
    echo"</html>\n";
    }
    else
    {
      //-----------[ 2]
    $connection = @mysql_connect("localhost","root", "716118wxy") or die("无法连接到数据库!");
    @mysql_select_db("guest") or die ( "选择数据库失败!");
    $query = "insert into guestbook(name, time, msg, email) ";
    $query.="values('$name',NULL,'$msg', 'email')";
    $result =@mysql_query( $query, $connnection ) or die ("存入数据库失败!");
    mysql_close( $connection ) or die ("关闭数据库失败!");
    echo"<html>\n";
    echo"<head>\n";
    echo"<title>成功了!</title>\n";
    echo"</head>\n";
    echo"<body bgcolor=#ffcc99><center>\n";
    echo"<h1><font color = blue >填写留言成功!</font></h1>\n";
    echo"<meta http-equiv=\"Refresh\" content=\"5; url=index.php\">";
    echo"<h3>五秒钟后自动返回</h3>\n";
    echo"<a href = index.php>立刻返回</a>";
    echo"</center></body>\n";
    echo"<html>";
    }
    }
    else if( $action == "放弃")// ------------[ 3]
    {
    echo"<meta http-equiv=\"refresh\" content=\"0; url =index.php\">";
    }
    else
    {
    if( $action == "reply" )
    {
    //-------------[ 4]
    $connection = @mysql_connect("localhost", "root", "716118wxy") or die ("无法连接到数据库!");
    @mysql_select_db("guest") or die("选择数据库失败!");
    $query = "select name,msg FROM guestbook ";
    $query.="where serial=$serial";
    $result = @mysql_query($query, $connection) or die("选择失败!");
    $row = mysql_fetch_array( $result );
    mysql_close( $connection ) or die (" 关闭数据库失败!");
    $text = "\n\n[&Ocirc;&Uacute;".$row[name]."的留言中提到\n".$row[msg];
    }
    //-------------[ 5]
    ?>


    <html>
    <head>
    <title>签写留言</title>
    </head><body bgcolor=#ffcc99>
    <center><h1><font color=blue>写留言</font></h1></cente>
    <table border=0 cellpadding=10 align=center>
    <td>
    <form method=POST action="<? echo " $PHP_SELF?action=$action"; ?>">
    昵称:<input type =text name="name" maxlength="20"><br>
    Email:<input type="text" name=email maxlength="30"><br>
    内容:<br>
    <textarea name="msg" rows="8" cols="60"><? echo $text; ?></textarea><br>
    <input type="submit" name="action" value="写好了!">
    <input type=reset value="重写">
    <input type=submit name=action value="放弃">
    </form>
    </td>
    </table>
    </body>
    </html>
    <?
    }
    ?>
      

  2.   

    <?
    if($_GET['action'] == "")
    {
    if( $_POST['name'] =="" || $_POST['msg'] =="" )
    {
    //------------[ 1]
    echo"<html>\n";
    echo"<head>\n";
    echo"<title>信息不全!昵称和内容是必须填写的!</title>\n";
    echo"</head>\n";
    echo"<body bgcolor=#ffcc99><center>\n";
    echo"<h1>出错了</h1>\n";
    echo"<p><font color = red>信息不全!昵称和内容是必须填写的!</font></p>\n";
    echo"<a href=\"javascript:history.go(-1)\">请重试</a>\n";
    echo"</center></body>\n";
    echo"</html>\n";
    }
    else
    {
      //-----------[ 2]
    $connection = @mysql_connect("localhost","root", "716118wxy") or die("无法连接到数据库!");
    @mysql_select_db("guest") or die ( "选择数据库失败!");
    $query = "insert into guestbook(name, time, msg, email) ";
    $query.="values({$_POST['name']},{time()},{$_POST['msg']},{$_POST['email']})";
    $result =@mysql_query( $query, $connnection ) or die ("存入数据库失败!");
    mysql_close($connection ) or die ("关闭数据库失败!");
    echo"<html>\n";
    echo"<head>\n";
    echo"<title>成功了!</title>\n";
    echo"</head>\n";
    echo"<body bgcolor=#ffcc99><center>\n";
    echo"<h1><font color = blue >填写留言成功!</font></h1>\n";
    echo"<meta http-equiv=\"Refresh\" content=\"5; url=index.php\">";
    echo"<h3>五秒钟后自动返回</h3>\n";
    echo"<a href = index.php>立刻返回</a>";
    echo"</center></body>\n";
    echo"<html>";
    }
    }
    else if( $action == "放弃")// ------------[ 3]
    {
    echo"<meta http-equiv=\"refresh\" content=\"0; url =index.php\">";
    }
    else
    {
    if( $action == "reply" )
    {
    //-------------[ 4]
    $connection = @mysql_connect("localhost", "root", "716118wxy") or die ("无法连接到数据库!");
    @mysql_select_db("guest") or die("选择数据库失败!");
    $query = "select name,msg FROM guestbook ";
    $query.="where serial=$serial";
    $result = @mysql_query($query, $connection) or die("选择失败!");
    $row = mysql_fetch_array( $result );
    mysql_close( $connection ) or die (" 关闭数据库失败!");
    $text = "\n\n[&Ocirc;&Uacute;".$row[name]."的留言中提到\n".$row[msg];
    }
    //-------------[ 5]
    ?>


    <html>
    <head>
    <title>签写留言</title>
    </head><body bgcolor=#ffcc99>
    <center><h1><font color=blue>写留言</font></h1></cente>
    <table border=0 cellpadding=10 align=center>
    <td>
    <form method=POST action="<? echo $PHP_SELF."?action=".$action; ?>">
    昵称:<input type =text name="name" maxlength="20"><br>
    Email:<input type="text" name="email" maxlength="30"><br>
    内容:<br>
    <textarea name="msg" rows="8" cols="60"><? echo $text; ?></textarea><br>
    <input type="submit" name="action" value="写好了!">
    <input type=reset value="重写">
    <input type=submit name=action value="放弃">
    </form>
    </td>
    </table>
    </body>
    </html>
    <?
    }
    ?>
      

  3.   

    谢谢您,这问题困扰我好几天了,我还以为是我MYSQL数据库安装时候的问题呢,弄得我这几天郁闷的要死~~~再次感谢您~~~