PHP+JS實現大規模資料提交的方法_php技巧

來源:互聯網
上載者:User

本文執行個體講述了PHP+JS實現大規模資料提交的方法。分享給大家供大家參考。具體實現方法如下:

<?php session_start();?><?phpif($_SESSION["login"] != "YES"){echo "<script languge=javascript> alert('您沒有登入,無權訪問,請先登入!');location.href='index.php'</script>";}?><!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"><!-- InstanceBegin template="/Templates/tmplet.dwt.php" codeOutsideHTMLIsLocked="true" --><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>簡訊群發管理系統</title><link type="text/css" rel="stylesheet" href="style/style.css" /><!-- InstanceBeginEditable name="EditRegion2" --><script type="text/javascript" src="lib/jquery.js"></script><script type="text/javascript" src="lib/maxlength.js"></script><script language="JavaScript" type="text/javascript"><!--function checkdata(){ if( myform.msgto.value == '' ){ alert ("接收方號碼不能全部為空白!");myform.focus();return false;}if(myform.content.value == ''){alert ("短訊息內容不可為空!");myform.focus();return false;}}function moveOption1(e1, e2){ try{ for(var i = 0; i < e1.options.length; i++){  if( e1.options[i].selected ){  var e = e1.options[i];e2.options.add(new Option(e.text, e.value));  e1.remove(i);  i = i - 1;  } } document.myform.msgto.value=getvalue(document.myform.list2); } catch(e){}}function moveOption2(e1, e2){ try{ for(var i = 0; i < e1.options.length; i++){  if(e1.options[i].selected ){  var e = e1.options[i];e2.options.add(new Option(e.text, e.value));  e1.remove(i);  i = i - 1;  } } document.myform.msgto.value=getvalue(document.myform.list2); } catch(e){}}function getvalue(geto){var allvalue = "";for(var i=0;i<geto.options.length;i++){allvalue +=geto.options[i].value + ",";}return allvalue;}function moveAllOption1(e1, e2){ try{ for(var i = 0;i < e1.options.length; i++){  var e = e1.options[i];  e2.options.add(new Option(e.text, e.value));  e1.remove(i);  i = i - 1; } document.myform.msgto.value=getvalue(document.myform.list2);  } catch(e){  }}function moveAllOption2(e1, e2){ try{ for(var i = 0;i < e1.options.length; i++){  var e = e1.options[i];  e2.options.add(new Option(e.text, e.value));  e1.remove(i);  i = i - 1; } document.myform.msgto.value=getvalue(document.myform.list2); } catch(e){ }}--></script><!-- InstanceEndEditable --></head><body><div id="container"> <div id="head"> </div> <div id="menu">  <ul>   <li id="first_li"><a href="group.php">傳送簡訊</a></li>   <li><a href="send_box.php">寄件匣</a></li>   <li><a href="recv_box.php">收件匣</a></li>   <li><a href="mynumber.php">管理電話薄</a></li>   <li><a href="autoreply.php">添加自動回複</a></li>   <li><a href="autoreply_ctl.php">管理自動回複</a></li>   <li><a href="toadmin.php">聯絡管理員</a></li>   <li><a href="logout.php">登出</a></li>  </ul> </div> <div id="crumbs">簡訊管理 >>> <!-- InstanceBeginEditable name="EditRegion3" -->  傳送簡訊   <!-- InstanceEndEditable --> </div> <div id="main">  <!-- InstanceBeginEditable name="EditRegion1" --><?php require_once('connecting.php'); ?><?php//php代碼$content=$_POST["content"];$msgto = $_POST["msgto"];if( $content != '' && $msgto != '' ) {$addtime = date("Y-m-d H:i:s");//號碼處理$msg2 = trim( $msgto, ',');$msg2 = explode( ',', $msg2 );if( $msg2 ) {foreach( $msg2 as $var ) {$query = "insert into sendmessage(numbersend,timesend,contentsend,flagsend) values ('$var','$addtime','$content','0')";mysql_query( $query );}echo "<script languge=javascript> alert('記錄成功,等待發送!'); location.href='send_box.php'</script>;";} else {echo "<script languge=javascript> alert('號碼不對,請核對!'); history.back(-1);</script>;";}}?>  <form method="post" name="myform" onsubmit="return checkdata();">   <div style=" padding-bottom:20px;"> <table border="0" width="100%" style="">    <tr>     <td bgcolor="#3399CC"  width="13%"><select style="width:100%;" multiple name="list1" size="15" ondblclick="moveOption1(document.myform.list1, document.myform.list2)"><?php $query = "select * from `number`";$result = mysql_query( $query );if( mysql_num_rows( $result ) < 1 ){echo "<option>  號碼為空白!></option>>";}else{$totalnum = mysql_num_rows($result);for( $i=0;$i <=$totalnum;$i++ ){$info = mysql_fetch_array( $result );if($info != ""){echo "<option value=".$info['num']."><font color=blue ><b>".$info['name']."</b></font></option><br>";}}}//elsemysql_close($member);?>      </select>     </td>     <td width="10%" align="center"><input type="button" value="添加" onClick="moveOption1(document.myform.list1, document.myform.list2)">      <br>      <br>      <input type="button" value="全選" onClick="moveAllOption1(document.myform.list1, document.myform.list2)">      <br>      <br>      <input type="button" value="刪除" onClick="moveOption2(document.myform.list2, document.myform.list1)">      <br>      <br>      <input type="button" value="全刪" onClick="moveAllOption2(document.myform.list2, document.myform.list1)">     </td>     <td bgcolor="#3399CC" width="13%"><select style="width:100%;" multiple name="list2" size="15" ondblclick="moveOption2(document.myform.list2, document.myform.list1)">      </select>     </td>     <td><table rules="none" align="center" cellpadding="1" cellspacing="10" border="0" >       <tr bgcolor="">        <td height="23" align="left" style="font-size:120%;"> 請將簡訊內容限制在70字以內。當前字數: <span id="status1" style="width:30px;font-weight:bold;text-align:right; font-size:150%; font-family:Georgia, 'Times New Roman', Times, serif"> </span></td>       </tr>       <tr>        <td><textarea name="content" style="width:350px; height:120px; font-size:150%;" data-maxsize="70" data-output="status1" wrap="virtual"></textarea></td>       </tr>       <tr>        <td height="24"><div align="center">          <input type="submit" name="namesubmit" value="發送" />         </div></td>       </tr>      </table></td>    </tr>   </table> </div>   <input type="hidden" name="msgto" value="" />  </form>  <!-- InstanceEndEditable --> </div> <div id="footer"><br />  ©2010  Designed By <cite></cite><img src="images/stone.gif" alt="石三" style="margin-left:15px; border:none;" /></a><br />  <br /> </div></div></body><!-- InstanceEnd --></html>

希望本文所述對大家的php程式設計有所協助。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.