PHP 8.5.2
Preview: add-testimonial.php Size: 6.91 KB
/home/serveshikshafoundation/htdocs/serveshikshafoundation.org.in/admin/html/add-testimonial.php

<?php
include('auth.php');
include('connection.php');

$msg = "";
// Check if form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $client_name = $conn->real_escape_string($_POST['clientName']);
    $profession = $conn->real_escape_string($_POST['profession']);
    $client_location = $conn->real_escape_string($_POST['clientLocation']);
    $client_rating = intval($_POST['clientRating']);
    $client_review = $conn->real_escape_string($_POST['clientReview']);

    // Insert query
    $sql = "INSERT INTO client_reviews (client_name,profession,client_location, client_rating, client_review) 
            VALUES ('$client_name', '$profession','$client_location', '$client_rating', '$client_review')";

    if ($conn->query($sql) === TRUE) {
        $msg = "<span id='successMsg' class='btn btn-success'>Review submitted successfully!</span>";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }
}
?>

<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Admin</title>
    <link rel="shortcut icon" type="image/png" href="../assets/images/logos/favicon.png" />
    <link rel="stylesheet" href="../assets/css/styles.min.css" />
</head>

<body>
    <!--  Body Wrapper -->
    <div class="page-wrapper" id="main-wrapper" data-layout="vertical" data-navbarbg="skin6" data-sidebartype="full"
        data-sidebar-position="fixed" data-header-position="fixed">

        <!-- Sidebar -->
        <?php include('aside.php') ?>

        <!--  Main Content -->
        <div class="body-wrapper">

            <!--  Header -->
            <?php include('header.php') ?>

            <div class="container-fluid">
                <?php
                // Fetch Reviews from Database
                $sql = "SELECT * FROM client_reviews ORDER BY created_at DESC";
                $result = $conn->query($sql);
                ?>
                <div class="container-fluid mt-5">

                    <h1 class="mb-2">Add Testimonials</h1>
                    <div id="msgContainer"><?php echo $msg; ?></div>

                    <form id="clientReviewForm " action="" method="post">
                        <div class="form-group">
                            <label for="clientName">Name:</label>
                            <input type="text" id="clientName" name="clientName" class="form-control" required>
                        </div>
                        <div class="form-group">
                            <label for="clientName">Profession:</label>
                            <input type="text" id="clientName" name="profession" class="form-control" required>
                        </div>
                        <div class="form-group">
                            <label for="clientLocation">Location:</label>
                            <input type="text" id="clientLocation" name="clientLocation" class="form-control" required>
                        </div>

                        <div class="form-group">
                            <label for="clientRating">Rating:</label>
                            <select id="clientRating" name="clientRating" class="form-control" required>
                                <option value="5">★★★★★</option>
                                <option value="4">★★★★☆</option>
                                <option value="3">★★★☆☆</option>
                                <option value="2">★★☆☆☆</option>
                                <option value="1">★☆☆☆☆</option>
                            </select>
                        </div>

                        <div class="form-group">
                            <label for="clientReview">Review:</label>
                            <textarea id="clientReview" name="clientReview" class="form-control" rows="4"
                                required></textarea>
                        </div>

                        <button type="submit" class="btn btn-primary mt-2">Submit Review</button>
                    </form>
                </div>
            </div>

            <div class="container-fluid pt-5">
                <h2 class="mb-3">Client Reviews</h2>
              <div class="table-responsive">
                
             
                <table class="table table-striped table-bordered">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>Name</th>
                            <th>Location</th>
                            <th>Rating</th>
                            <th>Review</th>
                            <!-- <th>Created At</th> -->
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php while ($row = $result->fetch_assoc()) { ?>
                            <tr>
                                <td><?php echo $row['id']; ?></td>
                                <td><?php echo htmlspecialchars($row['client_name']); ?></td>
                                <td><?php echo htmlspecialchars($row['client_location']); ?></td>
                                <td><?php echo str_repeat("★", $row['client_rating']) . str_repeat("☆", 5 - $row['client_rating']); ?>
                                </td>
                                <td><?php echo htmlspecialchars($row['client_review']); ?></td>
                                <td>
                                    <a href="edit-review.php?id=<?php echo $row['id']; ?>"
                                        class="btn btn-warning btn-sm">Edit</a>
                                    <a href="delete-review.php?delete_id=<?php echo $row['id']; ?>"
                                        class="btn btn-danger btn-sm"
                                        onclick="return confirm('Are you sure you want to delete this review?');">Delete</a>
                                </td>
                            </tr>
                        <?php } ?>
                    </tbody>
                </table>
                 </div>
            </div>

        </div>

        <script src="../assets/libs/jquery/dist/jquery.min.js"></script>
        <script src="../assets/libs/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
        <script src="../assets/js/sidebarmenu.js"></script>
        <script src="../assets/js/app.min.js"></script>
        <script src="../assets/libs/simplebar/dist/simplebar.js"></script>

        <script>
            // Hide success message after 2.5 seconds
            setTimeout(function () {
                var msgElement = document.getElementById("successMsg");
                if (msgElement) {
                    msgElement.style.display = "none";
                }
            }, 2000);
        </script>

</body>

</html>

Directory Contents

Dirs: 11 × Files: 30

Name Size Perms Modified Actions
- drwxr-xr-x 2025-04-05 16:58:42
Edit Download
assets DIR
- drwxr-xr-x 2025-04-05 16:58:42
Edit Download
baby-dec DIR
- drwxr-xr-x 2025-04-05 16:58:42
Edit Download
- drwxr-xr-x 2025-04-05 16:58:42
Edit Download
- drwxr-xr-x 2025-04-05 16:58:44
Edit Download
- drwxr-xr-x 2025-04-05 16:58:44
Edit Download
- drwxr-xr-x 2025-04-05 16:58:44
Edit Download
- drwxr-xr-x 2025-04-05 16:58:44
Edit Download
- drwxr-xr-x 2025-04-05 16:58:44
Edit Download
- drwxr-xr-x 2025-04-05 16:58:46
Edit Download
- drwxr-xr-x 2025-04-05 16:58:46
Edit Download
8.63 KB lrw-r----- 2025-04-06 01:10:32
Edit Download
8.49 KB lrw-r----- 2025-04-05 20:17:06
Edit Download
8.33 KB lrw-r----- 2025-04-01 18:04:14
Edit Download
4.67 KB lrw-r----- 2025-07-01 06:02:29
Edit Download
6.91 KB lrw-r----- 2025-04-07 09:05:32
Edit Download
4.59 KB lrw-r----- 2025-07-01 06:36:30
Edit Download
164 B lrw-r----- 2025-04-05 17:07:44
Edit Download
471 B lrw-r----- 2026-04-07 07:13:01
Edit Download
4.07 KB lrw-r----- 2025-04-07 18:20:40
Edit Download
1.62 KB lrw-r----- 2025-03-31 20:18:28
Edit Download
1.92 KB lrw-r----- 2025-04-01 00:02:56
Edit Download
1.93 KB lrw-r----- 2025-04-01 18:10:28
Edit Download
1.20 KB lrw-r----- 2025-04-02 21:38:00
Edit Download
1.94 KB lrw-r----- 2025-04-06 00:58:20
Edit Download
1.62 KB lrw-r----- 2025-07-01 06:05:36
Edit Download
1.67 KB lrw-r----- 2025-03-31 21:50:12
Edit Download
3.15 KB lrw-r----- 2025-04-02 22:26:14
Edit Download
5.43 KB lrw-r----- 2025-04-22 13:05:58
Edit Download
6.16 KB lrw-r----- 2025-04-05 20:16:08
Edit Download
6.18 KB lrw-r----- 2025-04-02 20:43:44
Edit Download
5.88 KB lrw-r----- 2025-04-02 21:46:38
Edit Download
3.17 KB lrw-r----- 2025-07-01 06:17:56
Edit Download
4.14 KB lrw-r----- 2025-03-31 22:30:04
Edit Download
551.14 KB lrw-r--r-- 2025-03-29 19:52:38
Edit Download
3.14 KB lrw-r----- 2025-06-28 23:18:18
Edit Download
4.67 KB lrw-r----- 2025-04-02 22:16:18
Edit Download
7.83 KB lrw-r----- 2025-04-05 23:49:56
Edit Download
3.15 KB lrw-r----- 2025-04-07 18:21:46
Edit Download
120 B lrw-r----- 2024-07-06 23:58:34
Edit Download
5.12 KB lrw-r----- 2025-03-31 22:33:26
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).