<html>
<body>
<form method="POST" action="comments.php">
<p> име: <input type="text" name="name" size="24"></p>
<p>текст: <input type="text" name="text" size="24">
<input type="submit" value="изпрати" name="send"></p>
</form>
<?
$status = "ok";
if (strlen($name) <2 ) { // проверка за попълнено име
$status= "error";}
if (strlen($text) <2 ) { // проверка за попълнен текст
$status= "error";}
if($status=="ok"){
mysql_pconnect("localhost","","") or die ( 'проблем при свързване с MySQL!' );
// ("localhost","DB_USER","DB_PASS")
mysql_select_db("test") or die ( 'Грешка при връзката!' );
$posted = time();
$query = mysql_query("INSERT komentari (name, text, posted) VALUES ('$name', '$text','$posted')");
}
?>
</body>
</html>
<? include "allcomments.php"; ?>