mardi 10 novembre 2015

How can i check the value in checkbox if its in database using php

I am trying to check the checkbox if the value is saved in the database but i don't have any idea at all.

First of all my checkbox is about sizes. EXTRA SMALL, SMALL, MEDIUM etc.

Here is my code to display my sizes and checkbox

$statement = $db->prepare("SELECT * FROM sizestops order by sizestopsID ASC");
$statement->execute();
while($rows = $statement->fetch(PDO::FETCH_ASSOC)) {
    $sizetopsCode = $row['sizetopsCode'];   
    echo "
        <label style='display: inline-block;
                font-size: 100%;
                font-family: Arial;
                width: 100px;'>
            <input type='checkbox' name='sizes[]' class='checkbox' id='sizesprod' onchange='checksize()' value='" .$rows['sizestopsID']. "'>" . $rows['sizetopsName'] ."</label>
            ";
    }

How can i check the value of the sizes? Please help me T_T




Aucun commentaire:

Enregistrer un commentaire