创新互联专注于网站建设,为客户提供成都网站建设、成都网站设计、网页设计开发服务,多年建网站服务经验,各类网站都可以开发,品牌网站建设,公司官网,公司展示网站,网站设计,建网站费用,建网站多少钱,价格优惠,收费合理。
for($i=0;$i<$num;$i++)
{
$n=$i+1;
echo "
$idd='stt_'.$i ;
echo "";
$add='add_'.$i ;
echo "
$id1='user_'."$i";
echo "
echo"
}
echo "";
?>
$(".sty").change(function() {
var inno = this.value;
var next = this.id.split('_')[1];
$.ajax({
type:'post',
url:"find_user.php?"+ Math.round(Math.random()*100),
data:{"inno":inno},
contentType: "application/x-www-form-urlencoded; charset=utf-8",
success:function(data) {
data = eval('('+data+')');
$("#user_"+next).empty();
for(i=0;i $("").val(data[i].empl).text(data[i].empl+'-'+data[i].name+'-'+data[i].dep).appendTo($("#user_"+next)); } }, error:function() { alert("error"); } }); }); //find_user.php require_once('/php/public/id.inc'); require_once('/php/public/opendb.inc'); require("/php/public/power.inc"); header("Content-type: text/html;charset=utf-8"); function field_ora($sql) { global $dbhUTF; $stmt = $dbhUTF->prepare("$sql"); if ($stmt->execute()) { return $stmt->fetch(); } } $inno=$_POST[inno]; $sql_exx="select depart_no from acc_gl_depart where acc_depart_no='$inno'"; $sql_exp=$dbhUTF->prepare($sql_exx); $sql_exp->execute(); list($dept_clear)=$sql_exp->fetch(); if($dept_clear=='516000'){ $sql4="select employee_no,name,get_depart(employee_no) from employee where depart_no ='$dept_clear' and lead_code='20' "; $sql4_exe=$dbhUTF->prepare($sql4); $sql4_exe->execute(); $i=0; while (list($employee_no,$name,$dept_no)=$sql4_exe->fetch()){ #echo "$employee_no-$name-$dept_no"; $a[$i]=array('empl'=>$employee_no,'name'=>$name,'dep'=>$dept_no); $i++; } } elseif($dept_clear=='300001' or $dept_clear=='300002' or $dept_clear=='300003' or $dept_clear=='300004'){ $dep_no3=substr($dept_clear,0,2); $sql4="select employee_no,name(employee_no),get_depart(employee_no) from psm_double_work where depart_no like '$dep_no3%'"; $sql4_exe=$dbhUTF->prepare($sql4); $sql4_exe->execute(); $i=0; while (list($employee_no,$name,$dept_no)=$sql4_exe->fetch()) { #echo "$employee_no-$name-$dept_no"; $a[$i]=array('empl'=>$employee_no,'name'=>$name,'dep'=>$dept_no); $i++; } } ELSE if($dept_clear=='J11040'){ $sql4="select employee_no,name,get_depart(employee_no) from employee where depart_no ='$dept_clear' and lead_code='50'"; $sql4_exe=$dbhUTF->prepare($sql4); $sql4_exe->execute(); $i=0; while (list($employee_no,$name,$dept_no)=$sql4_exe->fetch()){ #echo "$employee_no-$name-$dept_no"; $a[$i]=array('empl'=>$employee_no,'name'=>$name,'dep'=>$dept_no); $i++; } } else{ $dep_no1=substr($dept_clear,0,5)."0"; list($sqlcnt)=field_ora("select count(*) from psm_double_work where depart_no='$dep_no1'"); if ($sqlcnt>0) { $sql4="select employee_no,name(employee_no),get_depart(employee_no) from psm_double_work where depart_no='$dep_no1' order by lead_code desc "; $sql4_exe=$dbhUTF->prepare($sql4); $sql4_exe->execute(); $i=0; while (list($employee_no,$name,$dept_no)=$sql4_exe->fetch()) { # echo "$employee_no-$name-$dept_no"; $a[$i]=array('empl'=>$employee_no,'name'=>$name,'dep'=>$dept_no); $i++; } } else { $dep_no2=substr($dept_clear,0,3)."000"; list($sqlcnt2)=field_ora("select count(*) from psm_double_work where depart_no='$dep_no2'"); if ($sqlcnt2>0) { $sql4="select employee_no,name(employee_no),get_depart(employee_no) from psm_double_work where depart_no='$dep_no2'"; $sql4_exe=$dbhUTF->prepare($sql4); $sql4_exe->execute(); $i=0; while (list($employee_no,$name,$dept_no)=$sql4_exe->fetch()) { #echo "$employee_no-$name-$dept_no"; $a[$i]=array('empl'=>$employee_no,'name'=>$name,'dep'=>$dept_no); $i++; } } else { $dep_no3=substr($dept_clear,0,2)."0000"; $sql4="select employee_no,name(employee_no),get_depart(employee_no) from psm_double_work where depart_no='$dep_no3'"; $sql4_exe=$dbhUTF->prepare($sql4); $sql4_exe->execute(); $i=0; while (list($employee_no,$name,$dept_no)=$sql4_exe->fetch()) { # echo "$employee_no-$name-$dept_no"; $a[$i]=array('empl'=>$employee_no,'name'=>$name,'dep'=>$dept_no); $i++; } list($employee_no,$name,$dept_no)=$sql4_exe->fetch(); if (!$employee_no) { $sql5="select employee_no,name(employee_no),get_depart(employee_no) from employee where depart_no='$dept_clear'"; $sql5_exe=$dbhUTF->prepare($sql5); $sql5_exe->execute(); $i=0; while (list($employee_no,$name,$dept_no)=$sql5_exe->fetch()) { #echo "$employee_no-$name-$dept_no"; $a[$i]=array('empl'=>$employee_no,'name'=>$name,'dep'=>$dept_no); $i++; } } } } } echo json_encode($a); ?>
新闻标题:Ajax+juqery+php之两个selectoption控件传值
链接分享:http://cdxtjz.cn/article/ihdcde.html