I have a question currently this:
function addNameCheckBox(name) {
var html = "<div class='checkboxBlock'><label for='check_" + name + "'>" + name + ":</label><input type='checkbox' name='check_" + name + "' id='check_" + name + "' class='Stuff' /></div>";
$("#nameCheckboxContainer").append(html);
}
Adds a checkbox when clicking something but instead of name=' " name" ' blabla I want the values to be like $ploegnaam[] so I can fetch them for a post how would I do that?
The output of the name= now the names that are fetched from an ajax post.
I just want it simple to be something like $ploegnaam[] althou I google'd and tried it didnt work out.
You can append square brackets to your name, if you want to retrieve the values as an array in PHP:
<input name="foo[]" type="text" value="input1" />
<input name="foo[]" type="text" value="input2" />
and in php:
<?php print_r($_REQUEST['foo']); ?>
It returns an array:
array(
0 => 'input1',
1 => 'input2'
)