首页 > 开发 > PHP > 正文

让下拉列表又能选择又能输入

2024-05-04 22:59:37
字体:
来源:转载
供稿:网友
将下列代码复制到你的代码中,再修改成自己需要的


<?if ($fh_cp<>""){
$seek_cp="select gg,cp from bom where lh='$fh_cp' ";
$[email protected]_exec($link,$seek_cp);
$gg=trim(pg_result($result_cp,0,"gg"));
$cp=trim(pg_result($result_cp,0,"cp"));
$c_g=$cp.' '.$gg;

echo "<option selected value=/"$fh_cp/">$c_g</option>"; }?>
<?for($j=0;$j<$row_fh;$j++){
$gg_fh=trim(pg_result($result_fh,$j,"gg"));
$cp_fh=trim(pg_result($result_fh,$j,"cp"));
$seek_lh="select * from bom where cp='$cp_fh' and gg='$gg_fh' ";
$result_lh=pg_exec($link,$seek_lh);
$lh_fh=trim(pg_result($result_lh,0,"lh"));
$cp_gg=$cp_fh.' '.$gg_fh;

if($lh_fh==$fh_cp){
echo "<option selected value=/"$lh_fh/">$cp_gg</option>";
}
else{
echo "<option value=/"$lh_fh/">$cp_gg</option>";
}
}
?>


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表