function getFormSport() { $html = '<form method="post" action="AffichageNom.php" id="formInscription"><h1>Choix des sports</h1>'; for ($i = 1; $i <= 4; $i++) { $html .= "<label for=\"sport" . $i . "\"> Sport " . $i . "</label><select name=\"Sport" . $i . "\" required>"; foreach (getSport() as $value) { $html .= "<option value=\"" . $value['idSport'] . "\">" . $value['nom'] . "</option>"; } $html .= "</select><br/>"; } $html .= '<input type="submit" value="Envoyer" name="boutonEnvoyer"/></form>'; return $html; }
<?php require "include/include.php"; $name = $_GET["name"]; $data = explode("-", getSport($name)); echo $data[0];