JS代码
function changeappid(){
var appid=document.getElementById("appid").value;
$result = TSMLDB::getInstance()->select_sql("select f.appid,t.ftypeid,t.typename from wfappform f join wfformtype t on f.ftypeid=t.ftypeid");
$apptype = array();
while ($row = mysqli_fetch_array($result)):
$apptype[] =$row ;
endwhile;
mysqli_free_result($result);
$appcount=count($apptype);
?>
document.appform.formtypeid.length = 0;
var jsappcount=0;
jsapptype = new Array();
jsappcount=<?php echo $appcount;?>;
for($j=0;$j
{
?>
jsapptype[<?echo $j;?>] = new Array("<?php echo $apptype[$j]['appid'];?>","<?php echo $apptype[$j]['ftypeid'];?>","<?php echo $apptype[$j]['typename'];?>");
}
?>
document.appform.formtypeid.options[0] = new Option('Auto Select Type','');
var j;
for (j=0;j < jsappcount; j++)
{
if (jsapptype[j][0] == appid)
{
document.appform.formtypeid.options[document.appform.formtypeid.length] = new Option(jsapptype[j][2],jsapptype[j][1]);
}
}
}
php代码
form method="post" name="appform" action="<?php echo $_SERVER["PHP_SELF"]?>">
App | <?php echo ''; echo 'Select App'; $result = TSMLDB::getInstance()->select_wfapp(); while ($row = mysqli_fetch_array($result)): echo "" . $row["rmk"] . ""; endwhile; mysqli_free_result($result); echo ''; ?> |
ftype | Select Type |
name="appsubmit" value="StartApp" /> |
参考:
http://www.cnblogs.com/down/archive/2012/05/18/2507683.html
http://developer.51cto.com/art/200912/167998.htm
http://www.okajax.com/a/200812/1202R4H008.html
http://www.jb51.net/article/28904.htm