|
查看: 846|回复: 1
|
PHP MYSQL:SAVE DATA from Add new input box
[复制链接]
|
|
|
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 要怎样写呢? |
|
|
|
|
|
|
|
|
|
|
发表于 6-3-2008 01:22 AM
|
显示全部楼层
每 submit 一次,你可以这样取得 textbox 的资料:
$_POST["Textbox_Name"]
但你的 textbox 是随机产生的,所以你需要想办法计算 Textbox 的名字。 |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|