我需要帮助来解决如何使用动态创建多个文件夹input type textbox
?我只能在文件夹中创建单个动态子目录,但是当显示多个输入类型文本框时我想创建多个子文件夹?
问题是我一次只能使用输入类型文本框在文件夹中创建一个子目录
我已经使用 javascript 创建了多个文本框?
php代码
//creating a folder
$folder = implode($_POST['folder']);
for($i=0; $i<$folder; $i++)
{
$dirPath = 'uploads/'.$folder.[$i];
$result = mkdir($dirPath);
}
Javascript
<script type="text/javascript">
var i = 0;
function changeIt(){
i++;
var table=document.getElementById("itemdetail");
var row=table.insertRow();
var cell1=row.insertCell();
cell1.innerHTML="<input type='text' name='folder[]' id=folder_"+i+"'/>";
}
</script>
形式
<form method="post" enctype="multipart/form-data">
<input type="text" name="folder[]" id="folder_0" /><br />
//dynamically creating textbox into table row
<table id="itemdetail"></table>
<input type="button" n="addnewitem" id="addnewitem"
value="Add New Question" onClick="changeIt()"/>
</form>
例如
input type value is test1 ... uploads/subdirectory = test1
input type value is test2 ... uploads/subdirectory = test2
input type value is test3 ... uploads/subdirectory = test3