File "table_bootstrap01.php"

Full Path: /home/analogde/www/Administratif/FTP/Monsta-FTP-master/table_bootstrap01.php
File size: 2.26 KB
MIME-type: text/x-php
Charset: utf-8

<?php
// Capturer l'événement GET
if (isset($_GET['button'])) {
    $buttonValue = $_GET['button'];
    echo "<div class='alert alert-info text-center mt-3'>Vous avez cliqué sur le bouton : <strong>$buttonValue</strong></div>";
}

// Données pour remplir les colonnes
$rows = [
    ['nom' => 'Fichier 1', 'taille' => '10 Mo', 'heure' => '12:30'],
    ['nom' => 'Fichier 2', 'taille' => '20 Mo', 'heure' => '13:00'],
    ['nom' => 'Fichier 3', 'taille' => '15 Mo', 'heure' => '14:15'],
    ['nom' => 'Fichier 4', 'taille' => '50 Mo', 'heure' => '15:45'],
    ['nom' => 'Fichier 5', 'taille' => '100 Mo', 'heure' => '16:30'],
];
?>

<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Tableau avec Bootstrap</title>
    <!-- Lien vers Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <div class="container mt-5">
        <h1 class="text-center mb-4">Tableau avec Bootstrap</h1>

        <!-- Tableau -->
        <table class="table table-striped table-hover table-bordered">
            <thead class="table-dark">
                <tr>
                    <th>Nom</th>
                    <th>Taille</th>
                    <th>Heure</th>
                    <th>Action</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($rows as $index => $row): ?>
                    <tr>
                        <td><?= htmlspecialchars($row['nom']) ?></td>
                        <td><?= htmlspecialchars($row['taille']) ?></td>
                        <td><?= htmlspecialchars($row['heure']) ?></td>
                        <td>
                            <!-- Bouton stylisé avec Bootstrap -->
                            <a href="?button=<?= $index + 1 ?>" class="btn btn-primary btn-sm">
                                Action <?= $index + 1 ?>
                            </a>
                        </td>
                    </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>

    <!-- Lien vers Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>