查看文件: setSignup.php
大小: 3.41 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.php'); ?> <?php if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $deleteSQL = sprintf("DELETE FROM signup2 WHERE sgid=%s",$_POST['sgid']); mysql_select_db($database_BE2, $BE2); $Result1= mysql_query($deleteSQL, $BE2) or die(mysql_error()); for($i=0;$i<$_POST['allrec'];$i++){ if(isset($_POST['ck'.$i])){ $insertSQL = sprintf("INSERT INTO signup2 (sgid,sfid) VALUES ( '%s', '%s')", $_POST['sgid'],$_POST['cn'.$i]).'; '; mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($insertSQL, $BE2) or die(mysql_error()); } } if($insertSQL<>''){ } $insertGoTo = $_POST['url'];//"list_menu71.php"; header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_BE2, $BE2); $query_Rt3 = "SELECT count(sfkid1) as c1,sfkid1 FROM signup0 group by sfkid1 order by sfkid1"; $Rt3 = mysql_query($query_Rt3, $BE2) or die(mysql_error()); $row_Rt3 = mysql_fetch_assoc($Rt3); $totalRows_Rt3 = mysql_num_rows($Rt3); $arrkid=array(); $arrcount=array(); $arrdoc=array("報名資料設置","攜伴資料設置"); $c=0; do { $arrkid[$c]=$row_Rt3['sfkid1'] ; $arrcount[$c]=$row_Rt3['c1'] ; $c++; } while ($row_Rt3 = mysql_fetch_assoc($Rt3)); $editid=isset($_GET['editid'])?$_GET['editid']:'0'; mysql_select_db($database_BE2, $BE2); $query_Rt2 = sprintf("SELECT a.*,b.sfid2,b.sfid as f2 FROM signup0 as a left join signup2 as b on a.sfid=b.sfid AND b.sgid='%s' order by a.sfkid1,a.sfind ",$editid); //$query_Rt2 = sprintf("SELECT a.*,b.sfid2,b.sfid as f2 FROM signup_file as a left join signup2 as b on a.sfid=b.sfid AND b.sfid2='%s' order by a.sfkid1,a.sfind",$editid); $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); ?> <form id="form1" name="form1" method="POST" action=""> <table width="40%" border="0" align="center" cellpadding="0" cellspacing="4"> <tr bgcolor="#FFCC66"> <td width="19%" align="center"> </td> <td width="23%" align="center">選項</td> <td width="58%">說明 <input name="allrec" type="hidden" id="allrec" value="<? echo $totalRows_Rt2?>" /> <input name="sgid" type="hidden" id="sgid" value="<? echo $editid ;?>" /></td> </tr> <? $i=0; $ckrow=''; do { ?> <tr bgcolor="#FFCC99"> <? if($ckrow<>$row_Rt2['sfkid1']) { $ckrow=$row_Rt2['sfkid1']; $key = array_search($ckrow, $arrkid); // $key = c; ?> <td rowspan="<? echo $arrcount[$key]?>" align="center"><? echo $arrdoc[$key]?></td> <? }?> <td align="center"> <input name="ck<? echo $i ?>" type="checkbox" id="ck<? echo $i ?>" value="<? echo $row_Rt2['sfid2']?>" <? if($row_Rt2['sfid2']>0){ echo 'checked="checked"' ; }?> /> </td> <td><? echo $row_Rt2['sfdoc']?> <input name="cn<? echo $i ?>" type="hidden" id="cn<? echo $i ?>" value="<? echo $row_Rt2['sfid']?>" /></td> </tr> <? $i++; } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); ?> <tr> <td colspan="3" align="center"><input type="submit" name="button" id="button" value="送出" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> <input name="url" type="hidden" id="url" value="<? echo $_SERVER['HTTP_REFERER']?>" /> </form> <?php mysql_free_result($Rt3); mysql_free_result($Rt2); ?>
保存
取消
返回文件列表