查看文件: settb2add.php
大小: 6.93 KB
类型: application/octet-stream
<?php require('system/login.php'); ?> <?php require_once('../Connections/BE2.php'); ?> <?php if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO tb2 ( bc1, bc2, ec1, bc3, bc4, bc5, bc6, bc8, bc9,bukid,buind) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString("0", "int"), GetSQLValueString($_POST['bc2'], "text"), GetSQLValueString($_POST['ec1'], "int"), GetSQLValueString($_POST['bc3'], "text"), GetSQLValueString($_POST['bc4'], "text"), GetSQLValueString($_POST['bc5'], "text"), GetSQLValueString($_POST['bc6'], "text"), GetSQLValueString($_POST['bc8'], "text"), GetSQLValueString($_POST['bc9'], "text"), GetSQLValueString($_POST['bukid'], "text"), GetSQLValueString($_POST['buind'], "int")); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($insertSQL, $BE2) or die(mysql_error()); $insertcity= "INSERT INTO tb2city(buid2,ec1,ec3,bctaddr,bcttel) select a.buid,b.ec1,a.bc3,concat(a.bc4,a.bc5),a.bc6 from tb2 as a,tb1 as b WHERE a.bc3=b.ec3 order by buid desc limit 1"; mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($insertcity, $BE2) or die(mysql_error()); $updateGoTo =$_POST['url'];// "main.php?act=user"; header(sprintf("Location: %s", $updateGoTo)); } mysql_select_db($database_BE2, $BE2); $query_Rtc = "SELECT * FROM tb1 where tbc0=1 order by ec4"; $Rtc = mysql_query($query_Rtc, $BE2) or die(mysql_error()); $row_Rtc = mysql_fetch_assoc($Rtc); $totalRows_Rtc = mysql_num_rows($Rtc); ?> <script> function setcity0(){ var z=$("#ec1").val(); $('#bc3').find('option').remove().end(); var url="settb1city.php"; $.post(url,{"z":z }, function(data){ //alert(data); $('#bc3').find('option').remove().end().append(data); }); } function setcity1(){ //var z=$("#bc3").val(); var z=$("#bc3").find(":selected").text(); // $('#bc4').find('option').remove().end(); var url="settb1city1.php"; $.post(url,{"z":z }, function(data){ alert(data); // $('#bc4').find('option').remove().end().append(data); }); } function ceForm(){ var s=''; var de1 = $('#ck1').val(); var de2 = $('#ck2').val(); var ck = true; de1=jQuery.trim(de1); de2=jQuery.trim(de2); if( de1!='2.png' ) { s += '帳號為必要欄位及不可重複 ? \n'; ck =false; } if ( de2!='2.png' ){ s +='公司抬頭為必要欄位及不可重複..\n'; // alert("旅遊行程內文請勿少於10個字..\n"); ck = false; } if(s != '')alert (s); return ck; } </script> <form action="" method="POST" name="form1" id="form1"> <table width="549" align="center"> <tr valign="baseline"> <td nowrap="nowrap" align="right"> </td> <td> </td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><span class="font2">公司名稱:</span></td> <td><input type="text" name="bc2" size="32" /> <input type="hidden" name="bcc1" value="<?php echo htmlentities($row_Rt2['bcc1'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><span class="font2">區域:</span></td> <td><label for="bc3"></label> <select name="ec1" id="ec1" onchange="setcity0()"> <option value="1">北</option> <option value="2">中</option> <option value="3">南</option> <option value="4">東</option> </select></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><span class="font2">縣市分區:</span></td> <td><select name="bc3" id="bc3"> <?php do { ?> <option value="<?php echo $row_Rtc['ec3']?>"><?php echo $row_Rtc['ec1'].",".$row_Rtc['ec3']?></option> <?php } while ($row_Rtc = mysql_fetch_assoc($Rtc)); $rows = mysql_num_rows($Rtc); if($rows > 0) { mysql_data_seek($Rtc, 0); $row_Rtc = mysql_fetch_assoc($Rtc); } ?> </select> <input type="hidden" name="bcc2" value="<?php echo htmlentities($row_Rt2['bcc1'], ENT_COMPAT, 'utf-8'); ?>" size="32" /> <input type="hidden" name="bcc3" value="<?php echo htmlentities($row_Rt2['bcc1'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><span class="font2">性質:</span></td> <td><label for="bukid"></label> <select name="bukid" id="bukid"> <option value="1">測試</option> <option value="2">自營</option> <option value="3" selected="selected">公司</option> </select></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><span class="font2">分區</span>:</td> <td><input type="text" name="bc4" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><span class="font2">通訊處</span>:</td> <td><input type="text" name="bc5" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><span class="font2">電話FAX</span>:</td> <td><input type="text" name="bc6" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><span class="font2">租車業者</span>:</td> 0 <td><select name="bc8" id="bc8" > <option value="Y">Y</option> <option value="N">N</option> </select></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><span class="font2">行業別</span>:</td> <td> <? $a2 = "遊覽車公司,遊覽車業者(車主車),旅行社,租車公司,租車車隊,導遊領隊,翻譯員,飯店、民宿業者,餐飲業,修車廠,汽車材料供應商,禮品業,旅遊景點,保險業,其他"; // $a1= explode(",",$a2); ?> <select name="bc9" id="bc9" > <? for($i=0;$i< count($a1);$i++){ ?> <option value="<?= $a1[$i]?>"><?= $a1[$i]?></option> <? }?> </select></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><span class="font2">排列值</span>:</td> <td><input name="buind" type="text" id="buind" value="<?= rand(1000,9999);?>" size="12" maxlength="5" /> 排列值小於1000將會排列在前面</td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"> </td> <td><input type="submit" value="插入新記錄" /></td> </tr> </table> <input name="url" type="hidden" id="url" value="<?= $_SERVER['HTTP_REFERER']; ?>" /> <input type="hidden" name="MM_insert" value="form1" /> </form> <?php mysql_free_result($Rtc); ?>
保存
取消
返回文件列表