Skip to content

Instantly share code, notes, and snippets.

@VictorFursa
Created January 13, 2016 18:18
Show Gist options
  • Save VictorFursa/7a73121d0d8214662702 to your computer and use it in GitHub Desktop.
Save VictorFursa/7a73121d0d8214662702 to your computer and use it in GitHub Desktop.
<?php
include ("GuestBook.php");
$db = new Db();
$db->format($db->query("SELECT * FROM guest_book"));
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<title>Гостевая книга</title>
<meta charset="UTF-8">
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<header id="header" class="b3radius" >
<h1 id="logo"><img src="/logo/logo.png"></h1>
<nav>
<a href="index.php">Главная</a>|
<a href="recipes.php">Рецепты</a>|
<a href="snack.html">Закуски</a>|
<a href="view.php">Гостевая</a>|
<a href="registration.php">Регистрация</a>
</nav>
</header><h1 style="text-align: center;">Отзывы</h1>
<div id="message"><?php if(isset($_POST["save"])){
$object = new GuestBook($db,$_POST["name"],$_POST["email"],$_POST["message"]);
$object->save();
header("Location: view.php");
}
foreach(GuestBook::getAll($db) as $key =>$value) {
echo
"<h6>". $value['name'] . $value['date'] . "</h6>". "<br>".
$value['message'] . "<hr>";
}
?>
</div>
<div id="guestBook">
<form method="POST" action="view.php">
<em>Добавить отзыв</em><br>
<textarea cols="40" rows="10" name="message" required></textarea><br>
Как Вас зовут ? <br>
<input type="text" name="name" required/><br>
Email <br>
<input type="email" name="email"placeholder="email" required><br>
<input type="submit" name="save" value="Оставить отзыв"/>
</form>
</div>
<br><hr>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment