佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 846|回复: 1

PHP MYSQL:SAVE DATA from Add new input box

[复制链接]
发表于 5-3-2008 01:01 PM | 显示全部楼层 |阅读模式
code 如下:
//addHTMLControls.js
var arrInput = new Array(0);
  var arrInputValue = new Array(0);

function addInput() {
  arrInput.push(arrInput.length);
  arrInputValue.push("");
  display();
}

function display() {
  document.getElementById('parah').innerHTML="";
  for (intI=0;intI<arrInput.length;intI++) {
    document.getElementById('parah').innerHTML+=createInput(arrInput[intI], arrInputValue[intI]);
  }
}

function saveValue(intId,strValue) {
  arrInputValue[intId]=strValue;
}  

function createInput(id,value) {
  return "<input type='text' id='test "+ id +"' onChange='javascript:saveValue("+ id +",this.value)' value='"+ value +"'><br>";
}

function deleteInput() {
  if (arrInput.length > 0) {
     arrInput.pop();
     arrInputValue.pop();
  }
  display();
}
_____________________________
<html>
<head>
<script type="text/javascript"src="addHTMLControls.js"></script>
</head>


<body>
<p id="parah">Click below to dynamically create/remove input boxes in this field</p>

<a href="javascript:addInput()">Add more input field(s)</a><br>
<a href="javascript:deleteInput()">Remove field(s)</a>
</body>
</html>

如何把 这些textbox 的data SAVE进MYsql database?
code 要怎样写呢?
回复

使用道具 举报


ADVERTISEMENT

发表于 6-3-2008 01:22 AM | 显示全部楼层
每 submit 一次,你可以这样取得 textbox 的资料:

$_POST["Textbox_Name"]

但你的 textbox 是随机产生的,所以你需要想办法计算 Textbox 的名字。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 1-1-2026 10:25 PM , Processed in 0.118620 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表