Created
October 19, 2015 19:18
-
-
Save VictorFursa/3f044ebdb774b5239c87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Гостевая книга</title> | |
</head> | |
<body> | |
<form method="POST" action="guest.php"> | |
<h1><em>Гостевая книга</em></h1> | |
Оставьте отзыв<br> | |
<textarea cols="40" rows="10" name="text" ></textarea><br> | |
Как Вас зовут ? <br> | |
<input type="text" name="author" /><br><br> | |
<input type="submit" name="save" value="Оставить отзыв"/> | |
</form> | |
<?php | |
include_once('bd.php'); | |
$result = mysql_query(" | |
INSERT INTO guest(id,author,text,time) | |
VALUES('$id', '$text' , '$author' , '$time') | |
"); | |
$row = mysql_fetch_array($result); | |
if(isset($_POST['save'])){ | |
$text = strip_tags(trim($_POST['text'])); | |
$author = strip_tags(trim($_POST['author'])); | |
mysql_query("INSERT INTO guest SET text='$text' , author='$author'"); | |
$result = mysql_query("SELECT * FROM guest ORDER BY id DESC "); | |
while($row = mysql_fetch_array($result)){ ?> | |
<h1><?php echo "№ " . $row['id'] . " " . $row['author'];?></h1> | |
<p><?php echo $row['text'];?></p> | |
<p><?php echo $row['time']?></p> | |
<p><?php echo "Спасибо что оставили отзыв " . $row['author'] ?></p> | |
<hr> | |
<?php mysql_close() ; | |
}} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment