|===============================|
| customer_id | customer_name |
|===============================|
| 1 | vick |
| 2 | bawa |
| 3 | smith |
| 4 | goldy |
| 5 | jojo |
=================================
表中有两列。我已经应用了以下查询。但它显示了每个名称两次,但我希望每个名称都在下拉列表中显示一次。
请告诉我如何在下拉列表中只显示一次每个名字....我的第二个问题是..我想将所选值带到下一页....但第一个问题是如何显示每个名字customer_name 一次......但它显示每个名字两次......谢谢先生
<table>
<tr>
<td>customer name</td>
<td><select name="customer_name">
<?php
$query = 'SELECT customer_id, customer_name FROM customer_table';
$result = mysql_query($query, $db) or die(mysql_error($db));
while ($row = mysql_fetch_assoc($result))
{
foreach ($row as $value)
{
echo '<option value="' . $row['customer_id'] . '"> ' . $row['customer_name'] . '</option>';
}
}
?>
</select></td>
</tr>
</table>