samedi 11 avril 2015

How do i do so, when the first select has not been defined yet, the secound one will be deactivated?

Im wondering is it possible in php, to do when the first select has a value the next one will be activated, like having the secound one called album SELECTOR grayed out untill the category SELECTOR has been defined?



<?php
//CATEGORY SELECTOR
$sql = "SELECT * FROM category ORDER BY cat_id";
$result = $mysqli->query($sql);

echo "<select class='input' name='photo_category'>";
echo "<option disabled selected>Choose a category</option>";

while ($row = $result->fetch_array(MYSQLI_ASSOC)) {

echo "<option value='$row[cat_id]'>$row[cat_title]</option>";
}

echo "</select>";

//ALBUM SELECTOR
$sql = "SELECT * FROM albums WHERE album_type = 0 ORDER BY album_id";
$result = $mysqli->query($sql);

echo "<select class='input' name='photo_album'>";
echo "<option disabled selected>Choose an album</option>";

while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
echo "<option value='$row[album_id]'>$row[album_title]</option>";
}

echo "</select>";
?>

Aucun commentaire:

Enregistrer un commentaire