dimanche 29 mai 2016

From Select option to multiple checkbox

So i have this code where you can choose a specific Sub-genre of music. Right now you can only choose a single sub genre, but how can i code it so you can choose multiple sub-genres (maybe via checkbox) that can be inserted into a database?

    $day = $_POST["day"];
    $month = $_POST["month"];       
    $year = $_POST["year"];     
    $main = $_POST["main"];     

            $ne = "SELECT * FROM genre WHERE genre='0' AND main='$main'";
            $ne_query_run = mysql_query($ne);
    ?>
    <?php
            echo '<form action="site.php?koncert&fire" method="POST">';
            echo '<input type="text" name="day" class="hide" value="'.$day.'"/>';
            echo '<input type="text" name="month" class="hide" value="'.$month.'"/>';
            echo '<input type="text" name="year" class="hide" value="'.$year.'"/>';                                     echo '<input type="text" name="main" class="hide" value="'.$main.'"/>';
            echo '<select name="sub">';
            while($neo = mysql_fetch_assoc($ne_query_run)){

            $sub = $neo['sub'];

            echo '<option value="'.$sub.'">'.$sub.'</option';

            echo'</select><br /><br />';
            }
            echo '<input type="submit" name="submit"/>';
            echo '</form>';     




Aucun commentaire:

Enregistrer un commentaire