index.php:
Като му дам 'Send' не става НИЩО... само един коментар ми довави и то на половина... в БД имаше само името на автова с празно поле текст... Някой може ли да ми каже къде греша?
Код:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1251" />
<title>Guest book</title>
</head>
<body>
<form method="post" action="">
<table>
From: <input type="text" name="author" /><br />
Comment: <textarea type="text" name="text" cols="45" rows="3"></textarea><br />
<input type="submit" name="submit" value="Send!" />
</table>
</form>
<?php
require("config.php");
$sql = mysql_query("SELECT * FROM book ORDER BY id DESC") or die (mysql_error());
echo "<table>";
while($row = mysql_fetch_array($sql)){
echo "<tr><td>From: $row[author]</td></tr>
<tr><td>Comment: $row[text]</td></tr>
<tr><td><hr /></td></tr>";
}
echo "</table>";
$author = $_POST['author'];
$text = $_POST['text'];
if(isset($_POST['submit'])) {
$add = mysql_query("INSERT INTO book ('author', 'text') VALUES (`$author`, `$text`)");
echo "The comment has been send!";
}
?>
</body>
</html>