<form action="animals.php" method="post"> <fieldset> <select> <option value="species">Species</option> <option value="enclosure">Enclosure</option> <option value="animal">Animal</option> </select> <input type="submit" /> </fieldset> </form>
<?php include 'dbconnect.php'; if(isset($_POST['value'])) { if($_POST['value'] == 'species') { $query = "SELECT Speciesname FROM SPECIES inner join ANIMAL on ANIMAL.Species=SPECIES.Speciesid"; } elseif($_POST['value'] == 'enclosure') { $query = "SELECT Enclosurename FROM ENCLOSURE inner join ANIMAL on ANIMAL.Enclosure=ENCLOSURE.Enclosureid"; } else { $query = "SELECT Animalname FROM ANIMAL"; } $sql = mysql_query($query); while ($row = mysql_fetch_array($query)){ $species = $row["Speciesname"]; $enclosure = $row["Enclosurename"]; $animal = $row["Animalname"]; } } ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)