Kod
<script type="text/javascript">
var ile = 0;
dodajInput = function(parentElement)
{
ile++;
var input = document.createElement("input");
input.type = "text";
input.name = "kwota"+ile;
parentElement.appendChild(input);
}
dodajText = function(parentElement)
{
var input = document.createElement("input");
input.type = "text";
input.name = "ulica"+ile;
parentElement.appendChild(input);
}
Input = function(parentElement)
{
var input = document.createElement("input");
input.type = "hidden";
input.name = "ile";
input.value = ile;
parentElement.appendChild(input);
}
window.onload=function()
{
var dodaj = document.getElementById('dodajInput');
if(dodaj)
{
dodaj.onclick = function()
{
dodajInput(document.getElementById('dowozik'));
Input (document.getElementById('dowozik'));
dodajText(document.getElementById('dowozik'));
}
}
else
{
return false;
}
}
</script>
<form name="form" action="" method="POST">
<input type="button" id="dodajInput" value="dodaj pole pliku">
<div id="dowozik">
</div>
<input type="submit" name="x" value="y">
</form>
<?
for ($i=1; $i<=$_POST['ile'];$i++)
{
echo $i." ---> ".$_POST['kwota'.$i]." ---> ".$_POST['ulica'.$i]."<br>";
}
?>
var ile = 0;
dodajInput = function(parentElement)
{
ile++;
var input = document.createElement("input");
input.type = "text";
input.name = "kwota"+ile;
parentElement.appendChild(input);
}
dodajText = function(parentElement)
{
var input = document.createElement("input");
input.type = "text";
input.name = "ulica"+ile;
parentElement.appendChild(input);
}
Input = function(parentElement)
{
var input = document.createElement("input");
input.type = "hidden";
input.name = "ile";
input.value = ile;
parentElement.appendChild(input);
}
window.onload=function()
{
var dodaj = document.getElementById('dodajInput');
if(dodaj)
{
dodaj.onclick = function()
{
dodajInput(document.getElementById('dowozik'));
Input (document.getElementById('dowozik'));
dodajText(document.getElementById('dowozik'));
}
}
else
{
return false;
}
}
</script>
<form name="form" action="" method="POST">
<input type="button" id="dodajInput" value="dodaj pole pliku">
<div id="dowozik">
</div>
<input type="submit" name="x" value="y">
</form>
<?
for ($i=1; $i<=$_POST['ile'];$i++)
{
echo $i." ---> ".$_POST['kwota'.$i]." ---> ".$_POST['ulica'.$i]."<br>";
}
?>
Mam coś takiego udało mi się stworzyć jak teraz zrobić żeby ten input który tworzony jest przez dodajText był <textarea> </textarea>