我想在用户从下拉列表中选择一个选项后显示我的数据库中的详细信息。就像是 :
SELECT `details` FROM $tbl_name WHERE id= value of selected option
<?php
$db_name="pet"; // Database name
$tbl_name="lover"; // Table name
$pet_id=$_POST['pet_id']
$sql="SELECT details FROM $tbl_name WHERE id = $pet_id";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
$id=$rows['id'];
$details=$rows['details'];
// close while loop
}
?>
<select name="pet_id">
<option value="">Select PET:</options>
<option value="1">DOG</options>
<option value="2">BIRD</options>
<option value="3">FISH</options>
<a> then it will display details from database</a>