查看文件: welcome.php
大小: 3.78 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.php'); ?> <?php /* $write=''; if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL =''; for($i=1;$i<=$_POST['mycount'];$i++){ $updateSQL = sprintf("UPDATE ad_menu SET act_title='%s',act='%s',link_title='%s',link='%s',ind='%s',inds='%s' WHERE id ='%s'",$_POST['act_title'.$i],$_POST['act'.$i],$_POST['link_title'.$i],$_POST['link'.$i],$_POST['ind'.$i],$_POST['inds'.$i],$_POST['id'.$i]); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); $write='資料已更新...'; } } */ mysql_select_db($database_BE2, $BE2); $query_Rt2 = "SELECT * FROM ad_menu order by inds,ind ASC "; $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <p>welcome </p> <? if ( (substr($_SERVER['REMOTE_ADDR'],0,9)=='127.0.0.1' )or( $_SERVER['REMOTE_ADDR']=='220.130.43.118')){ ?> <form id="form1" name="form1" method="post" action=""> <table border="0" cellspacing="2" cellpadding="2"> <tr> <td>ID</td> <td>主標題</td> <td>連結</td> <td>子項目標題</td> <td>連結</td> <td>項目排序</td> <td>排序</td> <td>更新</td> </tr> <?php $i=0;?> <?php do { $i++; ?> <tr> <td><?php echo $i; ?></td> <td height="40"> <input name="act_title<?php echo $i; ?>" type="text" id="act_title<?php echo $i; ?>" value="<?php echo $row_Rt2['act_title']; ?>" size="15" /></td> <td><input name="act<?php echo $i; ?>" type="text" id="act<?php echo $i; ?>" value="<?php echo $row_Rt2['act']; ?>" size="15" /></td> <td><input name="link_title<?php echo $i; ?>" type="text" id="link_title<?php echo $i; ?>" value="<?php echo $row_Rt2['link_title']; ?>" size="15" /></td> <td><input name="link<?php echo $i; ?>" type="text" id="link<?php echo $i; ?>" value="<?php echo $row_Rt2['link']; ?>" size="15" /></td> <td align="center"><input name="inds<?php echo $i; ?>" type="text" id="inds<?php echo $i; ?>" value="<?php echo $row_Rt2['inds']; ?>" size="3" /></td> <td><input name="ind<?php echo $i; ?>" type="text" id="ind<?php echo $i; ?>" value="<?php echo $row_Rt2['ind']; ?>" size="3" /> <input name="id<? echo $i?>" type="hidden" id="id<? echo $i?>" value="<?php echo $row_Rt2['id']; ?>" /></td> <td align="center" valign="middle"> <button type="button" onclick="wel_update(<?php echo $i; ?>)">更新</button> </td> </tr> <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); ?> <tr> <td> </td> <td height="40"> </td> <td> </td> <td> </td> <td colspan="3"><? /* <input type="submit" name="button" id="button" value="更新資料" /> */ ?> <input name="mycount" type="hidden" id="mycount" value="<? echo $totalRows_Rt2;?>" /></td> </tr> </table> <input type="hidden" name="MM_update" value="form1"> </form> <? } ?> <script type="text/javascript"> function wel_update(i) { var id2=$('#id'+i).val(); var act_title=$('#act_title'+i).val(); var act=$('#act'+i).val(); var link_title=$('#link_title'+i).val(); var link2=$('#link'+i).val(); var inds=$('#inds'+i).val(); var ind=$('#ind'+i).val(); // alert(inds); $.ajax({ type: 'POST', url: 'wel_update.php', data: {'id2': id2,'act_title':act_title,'act':act,'link_title':link_title,'link2':link2,'inds':inds,'ind':ind }, success: function (data) { alert(data); } }); }; </script> <?php mysql_free_result($Rt2); ?>
保存
取消
返回文件列表