作者sky093851248 (jokerlin)
看板PHP
标题[请益] 新手请益 动态下拉式选单
时间Fri Apr 17 10:50:03 2015
不好意思
写了个连接资料库的下拉式选单
能够显示 选取
但无法取得选取的值
<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://webptt.com/cn.aspx?n=bbs/PHP/M.1429239008.A.776.html
1F:推 crossdunk: 感觉怪怪的 怎麽不直接用php来显示呢 04/17 10:57
2F:→ sky093851248: 不好意思 我自己找到问题了 谢谢各位>< 04/17 10:58