Cronos
04-23-2008, 01:52 PM
Hi.
I'm trying to submit (to PHP) a FORM with dynamically created INPUTs, but my INPUTs do not propagate.
What is wrong?
function write() {
target = document.getElementById('formsml');
spn = document.createElement('span');
txt = document.createTextNode(i);
lk = document.createElement('input');
lk.setAttribute('type', 'button');
lk.setAttribute('value', 'ny button');
lk.setAttribute('name', i); i++;
spn.appendChild(txt);
spn.appendChild(lk);
target.appendChild(spn);
}
HTML:
<form id="formsml" name="smli" method="post" action="form4.php?step=1">
<input type="button" onclick=write() name="klikknapp" value="lkdfj">
<div id="her"></div>
<INPUT type="checkbox" name="Debug" CHECKED>
<input type="submit" name="submit" VALUE="[COMMIT]>
</form>
No matter how many INPUTs I add via my function, the only two that comes through to the PHP file are "Debug" and "submit".
Anyway, what I'm trying to do is to fill up a "box" (DIV) with user input (1-30+ elements) and then submit that to a DB nicely.
I'm trying to submit (to PHP) a FORM with dynamically created INPUTs, but my INPUTs do not propagate.
What is wrong?
function write() {
target = document.getElementById('formsml');
spn = document.createElement('span');
txt = document.createTextNode(i);
lk = document.createElement('input');
lk.setAttribute('type', 'button');
lk.setAttribute('value', 'ny button');
lk.setAttribute('name', i); i++;
spn.appendChild(txt);
spn.appendChild(lk);
target.appendChild(spn);
}
HTML:
<form id="formsml" name="smli" method="post" action="form4.php?step=1">
<input type="button" onclick=write() name="klikknapp" value="lkdfj">
<div id="her"></div>
<INPUT type="checkbox" name="Debug" CHECKED>
<input type="submit" name="submit" VALUE="[COMMIT]>
</form>
No matter how many INPUTs I add via my function, the only two that comes through to the PHP file are "Debug" and "submit".
Anyway, what I'm trying to do is to fill up a "box" (DIV) with user input (1-30+ elements) and then submit that to a DB nicely.