麻辣家族討論版版's Archiver

xcoortir 發表於 2014-7-6 19:08

下拉式選單的問題

我的網站是 wangtom.no-ip.org/BOOK/1.php
我的name 跟item 的選項 按下submit會傳到另一個網頁inde.php
但我要怎麼顯式在inde.php網頁上
以下是我的程式
<form action=\"inde.php\" method=\"post\" target=\"_blank\">

<input type=\"submit\" value=\"submit\">
</form>
<label> name itme<br /></label>       
<?
$link = mysql_pconnect(\"localhost\", \"root\", \"0935820227\");
mysql_select_db(\"app\") or die(\"無法選擇資料庫\");


//mysql_select_db($dbName); //開啟資料庫,這邊這行會很多餘嗎?

$str = \"Select test1.Name,test2.item
FROM test1 join test2 join test3
on test1.pid=test3.pid AND test3.iid=test2.iid\"; //主要是希望0227_postofficenum這張資料表的local欄位資料全部進入下拉式選單...
$result = mysql_query($str); //sql查詢結果
$i=0;//處理序號。這是依你的程式處理,正規來說你因該要對應ID。不過我暫不理會。
echo '<select>';

//我改用mysql_fetch_assoc。因為這樣KEY才可對應到實體欄位名稱。mysql_fetch_row是只有數字KEY。比較不好。
while ($row = mysql_fetch_assoc($result)) {
$i++;
echo \"<option value=$i>\";
echo $row['Name'].' ';
echo $row['item'].\"<BR>\";
echo \"</option>\";
}
echo '</select>';

頁: [1]

麻辣家族討論版版為 麻辣學園 網站成員  由 昱得資訊工作室 © Since 1993 所提供