下面會顯示兩個下拉式清單,因為兩個下拉式清單的 資料都是來自同一個table,所以如果第一個A, 則第二個下拉式清單就不會A選項
例如:資料選項有a,b,c
則第一個選了a,則第二個下拉式清單只有b,c選項,請問這要怎麼改呢?
<form name="aaa" id="aaa" action="" method="post">
<table >
<tr >
<th>Seller</th>
<th>buyer</th>
<th>Date</th>
<th>addr</th>
<th>price</th>
</tr>
<tbody>
<tr>
<?
$sql="select customer from list;";
$result = mysql_query($sql);
if (!$result) {
die("Query to show fields from table failed");
}
$result_num = mysql_num_rows($result);
echo "<th>";
echo "<select name=\"seller\" size=\"0\" >" ;
for ($i=0;$i<$result_num;$i++)
{
$row = mysql_fetch_array($result);
$customer = $row['customer '];
echo "<option value=$customer >$customer </option>";
}
echo "</th>";
$sql="select customer from list;";
$result = mysql_query($sql);
if (!$result) {
die("Query to show fields from table failed");
}
$result_num = mysql_num_rows($result);
echo "<th>";
echo "<select name=\"buyer\" size=\"0\">" ;
for ($j=0;$j<$result_num;$j++)
{
$row = mysql_fetch_array($result);
$customer = $row['customer '];
echo "<option value=$customer >$customer </option>";
}
echo "</th>";
?>
..........
......................