<div class="home">

<h1>Gestion des marques des véhicules</h1>
        <form method= "POST" action= "index.php?uc=marque&action=ajouter">
        <button type= submit> Ajouter une nouvelle marque</button>
</form>
    <div id="Home_title"></div>
    

    
</table>
    <table class="table table-striped">
        <tr>
            <th>Libellé</th>
            <th></th> 
            <th></th> 
        </tr>
        
            <?php
            $lesMarques=getLesMarques();
            foreach($lesMarques as $uneMarque){
                echo "<tr>";
                if(isset($_REQUEST['action']) &&($_REQUEST['action']=='modifier') && isset($_REQUEST['id'])&& ($_REQUEST['id']==$uneMarque['mq_id'])){
                    echo ''
                    .'<form method= "POST" action= "index.php?uc=marque&action=validmodif">'
                    .'<td><input type="hidden" name="id" value="'.$_REQUEST['id'].'">'
                    .'<input type="text" name="mq_libelle" value"'.$uneMarque['mq_libelle'].'">'
                    .'<td><input type="submit" value="Valider"></td>'
                    .'</form>'
                    .'</td>'
                    .'<td></td>';
                }

                else{
                    echo 
                    '<td>'
                    .$uneMarque['mq_libelle']
                    .'</td>'
                    .'<td>'
                    .'<form method="POST" action="index.php?uc=marque&action=modifier">'
                    .'<td><input type="hidden" name="id" value="'.$uneMarque['mq_id'].'">'
                    .'<td><input type="submit" value="Modifier"></td>'
                    .'</form>'
                    .'</td>';

                    echo
                    '<td>'
                    .'<form method= "POST" action= "index.php?uc=marque&action=supprimer">'
                    .'<td><input type="hidden" name="id" value="'.$uneMarque['mq_id'].'">'
                    .'<td><input type="submit" value="Supprimer"></td>'
                    .'</form>'
                    .'</td>';

                }
                echo '</tr>';
                
            }
            ?>
    </table>
</div>
</div>