Javascript is not my thing. I will leave it at that. I am attempting to learn, but I’m much better at php and html. So, I’ve some Javascript to do what I need (add a text box when a button is pressed) but I have no idea how to connect the boxes created to variables that can then be transferred to my php processing form via post. any help would be great. here is the code so far.
<div id = "textfield1"></div>
<div id = "textfield2"></div>
<div id = "textfield3"></div>
<div id = "textfield4"></div>
<div id = "textfield5"></div>
<div id = "textfield6"></div>
<div id = "textfield7"></div>
<div id = "textfield8"></div>
<div id = "textfield9"></div>
<div id = "textfield10"></div>
<div id = "textfield11"></div>
<div id = "textfield12"></div>
<div id = "textfield13"></div>
<div id = "textfield14"></div>
<div id = "textfield15"></div>
<input type = "button" value = "Add Textbox" onclick = "addbox()">
<script type = "text/javascript">
var i = 1;
function addbox() {
if (i <= 15) { // max number of textboxes
document.getElementById('textfield'+[i]).innerHTML = "<input type='text' size = '20' />";
i++;
}
else {
alert ("No more textboxes possible")
}
}
</script>
You need to give your inputs name attributes…