
<div class="home">
    
    <h2>Formules :</h2>

    <form method="POST" action="index.php?uc=gestion&action=ajout_formule"><button type="submit" class="btn btn-primary">Ajouter une formule</button></form>

    <br><br>

    <table class="table table-bordered">

        <tr>

            <th>Libellé</th>

            <th>Prix</th>

            <th></th>

            <th></th>

        </tr>

        <?php
        
        foreach ($affichFormules as $uneFormule)
        {

            if ($_REQUEST["action"] == "modif_formule" && $uneFormule["libelleFormule"] == $libelle_a_modifier)
            {

                echo '<tr><form method="POST" name="modif_formule" action="index.php?uc=gestion&action=modifier_formule">'
                
                .'<td><input type="hidden" name="ancien_libelle" value="' . $uneFormule["libelleFormule"] . '"><input name="nv_libelle" type="text" value="' . $uneFormule["libelleFormule"] . '"></td><td><input name="nv_prix" type="text" value="' . $uneFormule["prixFormule"] . '"></td>'

                . '<td><button class="btn btn-success" type="submit">Valider</button></td></form></tr>';             

            }
            else
            {

                echo '<tr><td>' . $uneFormule["libelleFormule"] . '</td><td>' . $uneFormule["prixFormule"] . '</td>'

                . '<td><form method="POST" name="modif_formule" action="index.php?uc=gestion&action=modif_formule"><input name="libelle" type="hidden" value="' . $uneFormule["libelleFormule"] . '"><button class="btn btn-primary" type="submit">Modifier</button></form></td>'

                . '<td><form method="POST" name="suppr_module" action="index.php?uc=gestion&action=suppr_formule"><input name="libelle" type="hidden" value="' . $uneFormule["libelleFormule"] . '"><button class="btn btn-danger" type="submit">Supprimer</button></form></td>'

                . '</tr>';

            }

        }

        ?>

    </table>

</div>