Like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

<!

DOCTYPE html>

<html>

<head>

<style>

body {

font-family: Arial, sans-serif;

.poem {

border: 2px solid #333;

padding: 20px;

margin-bottom: 30px;

border-radius: 10px;

box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);

max-width: 600px;

margin: auto;

.poem h2 {

text-align: center;

margin-bottom: 15px;

font-size: 24px;

.poem img {
display: block;

margin: 0 auto 20px;

max-width: 100%;

height: auto;

.poem p {

text-align: justify;

font-size: 18px;

line-height: 1.6;

color: #555;

.like-dislike {

text-align: center;

margin-top: 20px;

.like-dislike button {

background-color: #4CAF50;

color: white;

border: none;

padding: 10px 20px;

font-size: 16px;

margin: 5px;
cursor: pointer;

border-radius: 5px;

transition: background-color 0.3s ease;

.like-dislike button:hover {

background-color: #45a049;

.dislike-btn {

background-color: #f44336;

.dislike-btn:hover {

background-color: #e53935;

/* Center the poem container */

.poem-container {

display: flex;

justify-content: center;

flex-wrap: wrap;

gap: 30px;

</style>
</head>

<body>

<div class="poem-container">

<?php

// Assuming you have a database query to fetch the poem

$sql = "SELECT * FROM poems";

$result = $con->query($sql);

// Check if records exist

if ($result->num_rows > 0) {

while ($row = $result->fetch_assoc()) {

echo "<div class='poem'>";

echo "<h2>" . $row['title'] . "</h2>";

echo "<img src='../uploads-folder/uploads/" . $row['image'] . "' alt='Poem Image'>";

echo "<p class='justified-text'>" . $row['text'] . "</p>";

echo "

<div class='like-dislike'>

<form action='like_dislike.php' method='POST'>

<input type='hidden' name='poem_id' value='" . $row['id'] . "'>

<button type='submit' name='action' value='like'>👍 Like</button>

<button type='submit' class='dislike-btn' name='action' value='dislike'>👎 Dislike</button>

</form>

</div>";
echo "</div>";

} else {

echo "No records found.";

?>

</div>

</body>

</html>

You might also like