Hi,
I've put together a little test page to create checkboxes each time a button is clicked. The check button is created and should be appended to the form, but when the post is submitted the dynamic checkboxes are not available in $_POST in PHP.
Here's the code:
[CODE=html]
<html>
<head>
<script language="Javas cript">
function append()
{
var cb = document.create Element( "input" );
cb.type = "checkbox";
cb.id = "id";
cb.value = "test";
cb.checked = true;
var text = document.create TextNode( "checkbox" );
document.getEle mentById( 'append' ).appendChild( text );
document.getEle mentById( 'append' ).appendChild( cb );
}
</script>
</head>
<body>
<p>click the button below</p>
<form action="http://localhost/test.php" name="form" id="form" method="post" enctype="multip art/form-data">
<div id="append" name="append">A ppend here</div>
<input type="button" value="append" onclick="javasc ript:append()" />
<input type="submit" value="submit" />
</form>
</body>
</html>
[/CODE]
Also is there a way to view the updated DOM tree at runtime? Viewing the page source doesn't show me what I've created at runtime.
Thanks,
Sean
I've put together a little test page to create checkboxes each time a button is clicked. The check button is created and should be appended to the form, but when the post is submitted the dynamic checkboxes are not available in $_POST in PHP.
Here's the code:
[CODE=html]
<html>
<head>
<script language="Javas cript">
function append()
{
var cb = document.create Element( "input" );
cb.type = "checkbox";
cb.id = "id";
cb.value = "test";
cb.checked = true;
var text = document.create TextNode( "checkbox" );
document.getEle mentById( 'append' ).appendChild( text );
document.getEle mentById( 'append' ).appendChild( cb );
}
</script>
</head>
<body>
<p>click the button below</p>
<form action="http://localhost/test.php" name="form" id="form" method="post" enctype="multip art/form-data">
<div id="append" name="append">A ppend here</div>
<input type="button" value="append" onclick="javasc ript:append()" />
<input type="submit" value="submit" />
</form>
</body>
</html>
[/CODE]
Also is there a way to view the updated DOM tree at runtime? Viewing the page source doesn't show me what I've created at runtime.
Thanks,
Sean
Comment