<div class="home">
    <table class="table table-striped">   
        <tr>
            <th><div id="Home_title">Gestion des marques des véhicules</div></th>
        </tr>
        <tr>
           <td><a href="index.php?uc=marque&action=ajouter">Ajouter une nouvelle marque</a></td>
        </tr>
    </table>
    <table class="table table-striped">
        <tr>
            <th>Libelle</th>
        </tr>
        <?php
        foreach($listeMarques as $marque)
        {
            $id = $marque['mq_id'];
            if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'modifier') 
            && isset($_REQUEST['id']) && ($_REQUEST['id'] == $id))
            {
                echo 
                '<tr>
                    <form name="valider" method="POST" action="index?uc=marque&action=validmodif">
                        <input type="hidden" name="id" value="'.$_REQUEST['id'].'">
                        <td>
                            <input type="text" name="nvLibelle" value="'.$marque["mq_libelle"].'"></input>
                        </td>
                        <td>
                            <button type="submit">Valider</button>
                        </td>
                    </form>
                </tr>';
            }
            else if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'supprimer') 
            && isset($_REQUEST['id']) && ($_REQUEST['id'] == $id))
            {
                echo 
                '<tr>
                    <form name="valider" method="POST" action="index?uc=marque&action=validsupprimer">
                        <input type="hidden" name="id" value="'.$_REQUEST['id'].'">
                        <td>
                            <p>êtes vous sûr de vouloir supprimer '.$marque["mq_libelle"].' ?</p>
                        </td>
                        <td>
                            <button type="submit">Valider</button>
                        </td>
                    </form>
                </tr>';
            }
            else
            {
                echo 
                '<tr>
                    <td>'.$marque["mq_libelle"].'</td>
                    <td>
                        <form name="modifier" method="POST" action="index?uc=marque&action=modifier">
                            <input type="hidden" name="id" value="'.$id.'">
                            <button type="submit">Modifier</button>
                        </form>
                    </td>
                    <td>
                        <form name="supprimer" method="POST" action="index?uc=marque&action=supprimer">
                            <input type="hidden" name="id" value="'.$id.'">
                            <button type="submit">Supprimer</button>
                        </form>
                    </td>
                </tr>';
            }
        }
        ?>
    </table>
</div>