vendredi 29 mars 2019

If session is set do this, if not run a while loop, not working?

Im attempting to fill a selection box with a session value if it is set. If not i need it to fill the selection box with a list of cups from my database. The session seems to be being set, however, the selection box isnt being filled, its still loading the list of cups.

<select name="cupname" required>
<option value='Holder' disabled selected>Please Select</option> 
    <?php
    if (isset($_SESSION['c_cname'])) {
        echo $_SESSION['c_cname'];
        exit();
    } else {
        while($rows = $resultSet->fetch_assoc()){
            $cupname = $rows['cup_name'];
            echo "  <option value='$cupname'>$cupname</option>";
        }
    }
?>
</select>

Aucun commentaire:

Enregistrer un commentaire