用php提交内容入库的程序

第一步:先作好如下的输入页面:
<html>
<head>
<title>phptext</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF">
<form method="post" action="tj.php">
  <table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
      <td>标题:
        <input type="text" name="bt" size="35">
      </td>
    </tr>
    <tr valign="top"> 
      <td>内容:<br>
        <textarea name="con" rows="18" cols="90"></textarea>
      </td>
    </tr>
    <tr>
      <td>
        <input type="submit" name="submit" value="提交">
        <input type="reset" name="Submit2" value="清除">
      </td>
    </tr>
  </table>
</form>
</body>
</html>
第二步:实现方法。
<?
$hostname
="localhost"
$username="root"
$password="password";
$dbName "username"
$userstable "phptext";  

//$limit =4; 


MYSQL_CONNECT($hostname$username$password) OR DIE("Unable to connect to database");
@
mysql_select_db"$dbName") or die( "Unable to select database"); 
if (
$submit)

$query "insert into $userstable (bt,con,time) values('$bt','$con',now())";

mysql_query($query);

echo 
"提交成功!";
echo 
"<a href='javascript:history.back()'>Back</a>";

?>