PHP/JS integration question
Posted: Mon Apr 03, 2006 5:43 am
Hello again.
Below is some JScript that creates new form elements (Thanks for the tip, Feyd, this was the right way to do it in the end!). When I submit the page, the contents of the textfields will be used to construct buttons on a preview page. Eventually, the contents will end up in a database.
I am having a problem envisaging how to get this to happen. For example, the user creates three sets of textfields and submits them to the form handler - how, then, does the form handler deal with the $_POST information if it doesn't know how many sets of textfields are coming? I'm guessing that the solution would be an array, but those of you who are familiar with older posts from me will know that I'm crap with arrays!
Any suggestions would be greatly appreciated!
Thanks in advance
Below is some JScript that creates new form elements (Thanks for the tip, Feyd, this was the right way to do it in the end!). When I submit the page, the contents of the textfields will be used to construct buttons on a preview page. Eventually, the contents will end up in a database.
Code: Select all
function addT(){
var root = document.getElementById('container');
var j=root.getElementsByTagName('div').length+1;
var clone = root.getElementsByTagName('div')[0].cloneNode(true);
var txt=clone.getElementsByTagName('input');
txt[0].name='link'+j;txt[0].value='URL';
txt[1].name='label'+j;txt[1].value='label';
root.appendChild(clone)
}Any suggestions would be greatly appreciated!
Thanks in advance