-1
我想通過不同的下拉列表顯示不同列的數據。每個下拉列表將顯示不同表格的數據。這是我的腳本,但它只顯示一個下拉列表中的所有數據。如何顯示來自不同列的不同下拉列表
<?php
$db = mysql_connect('localhost', 'root', '') or
die ('Unable to connect. Check your connection parameters.');
mysql_select_db('mobiledb', $db) or die(mysql_error($db));
?>
<html>
<head>
<title>rest</title>
</head>
<body>
<form action="commit.php method="post">
<table>
<tr>
<td>Movie Type</td>
<td><select name="movie_type">
<?php
$query = 'SELECT
customer_id, customer_name, customer_address, customer_order
FROM
customers';
$result = mysql_query($query, $db) or die(mysql_error($db));
while ($row = mysql_fetch_assoc($result))
{
echo '<option value="' . $row['customer_id'] . '"> ' . $row['customer_name'] . '</option>';
echo '<option value="' . $row['customer_id'] . '"> ' . $row['customer_address'] . '</option>';
echo '<option value="' . $row['customer_id'] . '"> ' . $row['customer_order'] . '</option>';
}
?>
</select></td>
</tr>
</table>
</form>
</body>
</html>
請不要再問[相同的問題](http://stackoverflow.com/users/2602526/vick?tab=questions)。 – hek2mgl
如果我理解正確,我認爲您可以刪除echo()並將其替換爲變量。像$ box1。=「
xlordt
SELECT customer_id,WHERE是什麼?好像你應該嘗試echo'$ row ['customer_id']'看看裏面有什麼,而不是runnin循環,你正在採取步驟,以大 –