Viewing File: /home/quiczmwg/public_html/admin/manage-testimonials.php

<?php
include 'head.php';
include 'header.php';

if(isset($_POST['btnSaveTestimonial'])){
    // Process and save the testimonial using PHP
    // Include the necessary files and perform the database operations
    // For example:
    include 'testimonial-process.php';
}
?>
<style>
    .edit-button {
    background-color: blue;
    color: white;
    padding: 5px 10px;
    text-decoration: none;
    border-radius: 5px;
}

.delete-button {
    background-color: red;
    color: white;
    padding: 5px 10px;
    text-decoration: none;
    border-radius: 5px;
}

</style>

<body class="skin-default fixed-layout">
    <div id="main-wrapper">
        <?php include 'sidebar.php'; ?>
        <div class="page-wrapper">
            <div class="container-fluid">
                <?php include 'nav.php'; ?>

                <!-- Admin Panel Section -->
                <div class="container">
                    <div class="text-right my-3">
                        <button type="button" class="btn text-white" data-toggle="modal" data-target="#myModal" style="background: rgb(2, 2, 83);">
                            <i class="bi bi-plus"></i> Add Testimonial
                        </button>
                    </div>
                </div>

                <!-- Testimonial Modal -->
                <div class="modal fade" id="myModal">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <!-- Modal Header -->
                            <div class="modal-header">
                                <h4 class="modal-title">Add Testimonial</h4>
                                <button type="button" class="close" data-dismiss="modal">&times;</button>
                            </div>
                            <!-- Modal Body -->
                            <div class="modal-body">
                                <form action="testimonial-process.php" method="post" enctype="multipart/form-data">
                                    <div class="form-group">
                                        <input name="name" class="form-control my-2" placeholder="Your Name" required>
                                    </div>
                                    <div class="form-group">
                                        <input name="title" class="form-control my-2" placeholder="Your title" required>
                                    </div>
                                    <div class="form-group">
                                        <textarea name="testimonial" class="form-control my-2" rows="5" placeholder="Your Testimonial" required></textarea>
                                    </div>
                                    <div class="form-group">
                                        <label for="country">Country:</label>
                                        <select name="country" id="country" class="form-control" required>
                                            <option value="">Select Country</option>
                                            <!-- Add options for countries -->
                                            <option value="USA">USA</option>
                                            <option value="UK">UK</option>
                                            <!-- Add more options as needed -->
                                        </select>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="submit" name="btnSaveTestimonial" class="btn btn-success bg-warn">Submit</button>
                                        <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>


                <!-- Testimonials Section -->
                <section>
                    <div class="container-fluid">
                        <div class="card">
                            <div class="card-body">
                                <h4 class="card-title">Testimonials</h4>
                                <div class="table-responsive">
                                    <table class="table">
                                        <thead>
                                            <th>#</th>
                                            <th>Image</th>
                                            <th>Name</th>
                                            <th>Title</th>
                                            <th>Testimonial</th>
                                            <th>Country</th>
                                            <th>Date</th>
                                        </thead>
                                        <tbody>
                                            <?php
                                            // Fetch testimonials from the database and display them here
                                            // For example:
                                            $testimonials = $conn->query("SELECT * FROM testimonials ORDER BY id ASC");
                                            while ($row = $testimonials->fetch_assoc()) {
                                                echo "<tr>";
                                                echo "<td>" . $row['id'] . "</td>";
                                                echo "<td><i class='fas fa-user'></i></td>";
                                                echo "<td>" . $row['name'] . "</td>";
                                                echo "<td>" . $row['title'] . "</td>";
                                                echo "<td>" . $row['testimonial'] . "</td>";
                                                echo "<td>" . $row['country'] . "</td>";
                                                echo "<td>" . $row['created_at'] . "</td>";
                                                echo "<td><a href='edit-testimonial.php?id=" . $row['id'] . "' class='edit-button'>Edit</a></td>";
                                                echo "<td><a href='delete-testimonial.php?id=" . $row['id'] . "' class='delete-button'>Delete</a></td>";

                                                echo "</tr>";
                                            }
                                            ?>
                                        </tbody>

                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            </div>
        </div>
    </div>

    <?php include 'footer.php'; ?>
</body>
Back to Directory File Manager
<