[請益] 新手請益 動態下拉式選單
不好意思
寫了個連接資料庫的下拉式選單
能夠顯示 選取
但無法取得選取的值
<select name="Type" id="Type" onChange='sele(this)' >
</select>
<?php
$result = mysql_query("SELECT ItemNo, ItemName FROM Itemlist WHERE ItemClass
= 'news_type1' and CompanySn = 1", $link) or die("error");
while($row = mysql_fetch_array($result))
{
$t1++;
$type[$t1]=$row[ItemName];
$typeNo[$t1]=$row[ItemNo];
}
?>
<?php
for($i=0;$i<=count($type);$i++)
{
echo "<script type=\"text/javascript\">";
echo "document.getElementById(\"Type\").options[$i]=new Option
(\"$type[$i]\",\"$typeNo[$i]\");";
echo "</script>";
}
?>
請問是我哪裡沒注意到嗎?
先在這裡謝謝各位
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.46.35.193
※ 文章網址: https://www.ptt.cc/bbs/PHP/M.1429239008.A.776.html
推
04/17 10:57, , 1F
04/17 10:57, 1F
→
04/17 10:58, , 2F
04/17 10:58, 2F