查看文件: swin_202501.php
大小: 12.49 KB
类型: application/octet-stream
<?php require_once('../Connections/BEB2.php'); ?> <? $city = '宜蘭縣'; mysql_select_db($database_BEB2, $BEB2); // address_id county district street $query_Rot2 = "SELECT distinct(county) FROM address where 1 order by address_id"; $Rot2 = mysql_query($query_Rot2, $BEB2) or die(mysql_error()); $row_Rot2 = mysql_fetch_assoc($Rot2); $totalRows_Rot2 = mysql_num_rows($Rot2); mysql_select_db($database_BEB2, $BEB2); // address_id county district street $query_Rat2 = sprintf("SELECT distinct(district) FROM address where county='%s' order by district",$city); $Rat2 = mysql_query($query_Rat2, $BEB2) or die(mysql_error()); $row_Rat2 = mysql_fetch_assoc($Rat2); $totalRows_Rat2 = mysql_num_rows($Rat2); $district=$row_Rat2['district']; mysql_select_db($database_BEB2, $BEB2); // address_id county district street $query_Rbt2 = sprintf("SELECT address_id,street FROM address where county='%s' AND district='%s' order by street",$city, $district); $Rbt2 = mysql_query($query_Rbt2, $BEB2) or die(mysql_error()); $row_Rbt2 = mysql_fetch_assoc($Rbt2); $totalRows_Rbt2 = mysql_num_rows($Rbt2); // mysql_select_db($database_BEB2, $BEB2); // address_id county district street $query_Rct2 = sprintf("SELECT * FROM dat1 where a3='%s' order by a1",'分齡賽'); $Rct2 = mysql_query($query_Rct2, $BEB2) or die(mysql_error()); $row_Rct2 = mysql_fetch_assoc($Rct2); $totalRows_Rct2 = mysql_num_rows($Rct2); // ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script src="/assets/vendor/jquery/jquery.min.js"></script> <script src="/assets/vendor/bootstrap/bootstrap.min.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>國慶盃分齡游泳錦標賽 測試用</title> </head> <body> 國慶盃分齡游泳錦標賽 測試用 <table width="100" border="1" cellpadding="1" id="myTable"> <tr> <td nowrap="nowrap"><font style="font-size:15px">身分證字號</font></td> <td nowrap="nowrap"><font style="font-size:15px">姓名</font></td> <td nowrap="nowrap"><font style="font-size:15px">性別</font></td> <td nowrap="nowrap"><font style="font-size:15px">生日</font></td> <td nowrap="nowrap"><font style="font-size:15px">行動電話</font></td> <td nowrap="nowrap"><font style="font-size:15px">地址</font></td> <td nowrap="nowrap"><font style="font-size:15px">Email</font></td> <td nowrap="nowrap"><font style="font-size:15px">賽別</font></td> <td nowrap="nowrap"><font style="font-size:15px">賽名 <? $vcount=0; ?> <input name="vcount" type="hidden" id="vcount" value="<?= $vcount; ?>" /> </font></td> <td nowrap="nowrap"> <input type="button" onclick="addrow();" value="報名 新增" /> </td> <td nowrap="nowrap"> </td> <td nowrap="nowrap"> </td> </tr> <tr id="myTableRow<?= $vcount; ?>"> <td height="38"><input name="bdid<?= $vcount; ?>" type="text" id="bdid<?= $vcount; ?>" value="" size="10" maxlength="12" onkeyup="bdidfound(<?= $vcount; ?>)" /></td> <td><input name="bname<?= $vcount; ?>" type="text" id="bname<?= $vcount; ?>" value="" size="10" maxlength="12" /></td> <td> <select name="bsex<?= $vcount; ?>" id="bsex<?= $vcount; ?>"> <option value="男" >男</option> <option value="女" >女</option> </select> </td> <td><table width="100" border="1" cellpadding="1"> <tr> <td> <select name="byy<?= $vcount; ?>" id="byy<?= $vcount; ?>" onchange="set_bkind(<?= $vcount; ?>)"> <? for($i=2025;$i>1929;$i--){?> <option value="<?=$i?>"><?=$i-1911?></option> <? }?> </select> </td> <td> <select name="bmm<?= $vcount; ?>" id="bmm<?= $vcount; ?>" onchange="set_bkind(<?= $vcount; ?>)"> <? for($i=1;$i<13;$i++){?> <option value="<?=$i?>"><?= sprintf('%02d',$i)?></option> <? }?> </select> </td> <td> <select name="bdd<?= $vcount; ?>" id="bdd<?= $vcount; ?>" onchange="set_bkind(<?= $vcount; ?>)"> <? for($i=1;$i<32;$i++){?> <option value="<?=$i?>"><?= sprintf('%02d',$i)?></option> <? }?> </select> </td> </tr> </table> </td> <td><input name="btel<?= $vcount; ?>" type="text" id="btel<?= $vcount; ?>" value="" size="10" maxlength="12" /></td> <td nowrap="nowrap"><select name="city<?= $vcount; ?>" id="city<?= $vcount; ?>" onchange="Selectcity(<?= $vcount; ?>)"> <? do { ?> <option value="<?= $row_Rot2['county']; ?>" <?= ($row_Rot2['county']==$city)?'selected="selected"':""; ?>> <?= $row_Rot2['county']; ?> </option> <?php } while ($row_Rot2 = mysql_fetch_assoc($Rot2)); ?> </select> <select name="district<?= $vcount; ?>" id="district<?= $vcount; ?>" onchange="Selectstreet(<?= $vcount; ?>);"> <? $address_name .= $row_Rat2['district'].','; do { ?> <option value="<?= $row_Rat2['district']; ?>" <?= ($row_Rat2['district']==$district)?'selected="selected"':""; ?>> <?= $row_Rat2['district']; ?> </option> <? } while ($row_Rat2 = mysql_fetch_assoc($Rat2)); ?> </select> <select name="street<?= $vcount; ?>" id="street<?= $vcount; ?>" onchange="show_id(<?= $vcount; ?>)"> <? do { ?> <option value="<?= $row_Rbt2['street']; ?>" > <?= $row_Rbt2['street']; ?> </option> <? } while ($row_Rbt2 = mysql_fetch_assoc($Rbt2)); ?> </select></td> <td><input name="bemail<?= $vcount; ?>" type="text" id="bemail<?= $vcount; ?>" value="" size="30" maxlength="60" /></td> <td> <input name="bkind<?= $vcount; ?>" type="text" id="bkind<?= $vcount; ?>" value="" size="15" maxlength="60" readonly="readonly" /> <? /* <select name="bkind<?= $vcount; ?>" id="bkind<?= $vcount; ?>"> <option value="分齡賽" selected="selected">分齡賽</option> <option value="趣味競賽">趣味競賽</option> <option value="大隊接力">大隊接力</option> </select> */ ?> </td> <td> <select name="bsport<?= $vcount; ?>" id="bsport<?= $vcount; ?>" > <? do { ?> <option value="<?= $row_Rct2['a2']; ?>"><?= $row_Rct2['a2']; ?></option> <? } while ($row_Rct2 = mysql_fetch_assoc($Rct2)); ?> </select> </td> <td><input type="button" onclick="saverow(<?= $vcount; ?>);" value="報名寫入" /></td> <td> <input name="bid<?= $vcount; ?>" type="hidden" id="bid<?= $vcount; ?>" value="0" /></td> <td> </td> </tr> </table> <script type="text/javascript"> function addrow() { var x=$('#vcount').val(); var s=""; x=x*1+1; $('#vcount').val(x); $.ajax({ type: 'POST', url: 'api01.php', data: { 'co': x,'disc':x }, success: function (data) { $('#myTable').append(data); } }); return false; }; function bdidfound(i) { $('#bdid'+i).val($('#bdid'+i).val().toUpperCase()); var bdid=$('#bdid'+i).val(); if ( checkID( bdid ) && $('#bname'+i).val().length==0 ){ //alert( "身份證字號PASS!" ); // user api $.ajax({ type: 'POST', url: 'memberfound.php', data: { 'bdid': bdid }, success: function (data) { // the next thing you want to do var objJSON = JSON.parse(data); if(objJSON.msg=='OK'){ $('#bname'+i).val(objJSON.bname); $('#bemail'+i).val(objJSON.bemail); $('#btel'+i).val(objJSON.btel); $('#bsex'+i).val(objJSON.bsex).change(); $('#city'+i).val(objJSON.city).change(); $('#byy'+i).val(objJSON.byy).change(); $('#bmm'+i).val(objJSON.bmm).change(); $('#bdd'+i).val(objJSON.bdd).change(); setcity2(i,objJSON.district,objJSON.street); //alert('yymmdd'); //alert(objJSON.district); //Selectcity(i); //$('#district'+i).val(objJSON.district).change(); //$('#street'+i).val(objJSON.street);//change(); //alert(objJSON.district); // alert(objJSON.city); } //else{alert(objJSON.msg);} } }); // end user api post } } function set_bkind(i){ var bsex=$('#bsex'+i).val(); var byy=$('#byy'+i).val(); var bmm=$('#bmm'+i).val(); var bdd=$('#bdd'+i).val(); $.ajax({ type: 'POST', url: 'apisetkind.php', data: { 'bsex':bsex,'byy':byy,'bmm':bmm,'bdd':bdd}, success: function (data) { $('#bkind'+i).val(data); } }); } function setcity2(i,d,st) { setTimeout(function() { $('#district'+i).val(d).change(); //alert($('#district'+i).val()); setTimeout(function() { $('#street'+i).val(st); //alert($('#district'+i).val()); }, 500); }, 500); } function saverow(i) { var bdid=$('#bdid'+i).val(); var bname=$('#bname'+i).val(); var bsex=$('#bsex'+i).val(); var byy=$('#byy'+i).val(); var bmm=$('#bmm'+i).val(); var bdd=$('#bdd'+i).val(); var btel=$('#btel'+i).val(); var bcity=$('#city'+i).val(); var bdistrict=$('#district'+i).val(); var bstreet=$('#street'+i).val(); var bemail=$('#bemail'+i).val(); var bkind=$('#bkind'+i).val(); var bsport=$('#bsport'+i).val(); var bid=$('#bid'+i).val(); if ( ! checkLength( bname, 2 ) ){ alert( "姓名資料錯誤!" ); exit; } if ( ! checkID( bdid ) ){ alert( "身份證字號錯誤!" ); exit; } if ( ! checkEmail( bemail ) ){ alert( "Email 位址資料錯誤!" ); exit; } $.ajax({ type: 'POST', url: 'apipost01.php', data: { 'bdid': bdid,'bname':bname,'bsex':bsex,'byy':byy,'bmm':bmm ,'bdd':bdd,'btel':btel,'bcity':bcity,'bdistrict':bdistrict ,'bstreet':bstreet,'bemail':bemail,'bkind':bkind,'bsport':bsport ,'bid':bid }, success: function (data) { $('#bid'+i).val(data); } }); //=================// return false; }; function Selectstreet(i) { var county= $("#city"+i).val(); // $(city).find(':selected')[0].id; var district = $("#district"+i).val(); //.find(':selected')[0].id; $.ajax({ type: 'POST', url: 'SelectstreetApi.php', data: { 'county': county,'district':district }, success: function (data) { // the next thing you want to do var $street = $('#street'+i); $street.empty(); $("select#street"+i).html(data); show_id(i); } }); } function Selectcity(i) { var county= $("#city"+i).val(); // $(city).find(':selected')[0].id; $.ajax({ type: 'POST', url: 'SelectcityApi.php', data: {'county': county}, success: function (data) { // the next thing you want to do var $street = $('#street'+i); $street.empty(); var $district = $('#district'+i); $district.empty(); $("select#district"+i).html(data); Selectstreet(i); } }); } function show_id(i){ // var s=$('#city'+i).val()+","+$('#district'+i).val()+","+$.trim($('#street'+i).find(":selected").text()); // $('#maddress_id').val($('#street').val()); // $('#maddress_name'+i).val(s); // alert(1); } function checkLength( dat, len ) { return (dat.length >= len); } function checkEmail( id ) { return ( checkLength(id, 5) && id.indexOf("@") != -1 ); } function checkID( id ) { tab = "ABCDEFGHJKLMNPQRSTUVWXYZIO" A1 = new Array (1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3 ); A2 = new Array (0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5 ); Mx = new Array (9,8,7,6,5,4,3,2,1,1); if ( id.length != 10 ) return false; i = tab.indexOf( id.charAt(0) ); if ( i == -1 ) return false; sum = A1[i] + A2[i]*9; for ( i=1; i<10; i++ ) { v = parseInt( id.charAt(i) ); if ( isNaN(v) ) return false; sum = sum + v * Mx[i]; } if ( sum % 10 != 0 ) return false; return true; } </script> <? mysql_free_result($Rot2); mysql_free_result($Rat2); mysql_free_result($Rbt2); mysql_free_result($Rct2); ?> </body> </html>
保存
取消
返回文件列表