日期:2014-05-17 浏览次数:20631 次
<?php
$con=mysql_connect("localhost","root","");
mysql_select_db("test");
mysql_query("set names gb2312");
?>
<?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>";
?>