日期:2014-05-17  浏览次数:20530 次

求助一个关于php构建测试表单的问题
PHP code

<?php
$con=mysql_connect("localhost","root","");
mysql_select_db("test");
mysql_query("set names gb2312");
?>


这是初始的服务器config.
PHP code

<?php
error_reporting(E_ALL & ~ E_NOTICE);
echo "<center>";
if (!$_POST["test_name"])
{
    echo "<h2>create test</h2>";
    echo "<table border=1>";
    echo "<form method=post action=".$_SERVER["PHP_SELF"].">";
    echo "<tr>";
    echo "<td>test question</td>";
    echo "<td><input type=text name=test_name></td>";
    echo "</tr>";
    echo "<tr>";
    echo "<td colspan=2><center><input type=submit value=next></center></td>";
    echo "</tr>";
    echo "</form>";
    echo "</table>";
}
else 
{
    include 'config.php';
    $content=$_POST["test_name"];
    $sql="insert into question('content') values('$content')";
    if (mysql_query($sql))
    {
        echo "create test_content successfull!!!";
        echo "<p>";
        echo "click<a href=add_question.php>here</a>to add question";
    }
    else "error!!!".mysql_error();
    mysql_close();
}
echo "<center>";
?>


现在问题是这样的,创建不了表单,求大神帮我指点指点...为什么会出现这样的状况..谢谢了

------解决方案--------------------
$sql="insert into question(`content`) values('$content')"; //content的注释符号写错了