I have a that has a list of checkboxes and user can click any number then click submit. The list of checkboxes is generated based on the results of a mySQL query -
echo("<form id=\"target\" action = \"#\">");
echo("<ul>");
while($row = mysql_fetch_array($result) {
$the_value = $row['result_value'];
$the_label = $row['result_label'];
echo("<li><input type='checkbox' name=\"ids[]\" value='" . $the_value . "'/> " . $the_label . "</li>\n");
echo("</ul>");
echo("<input type=\"submit\" value =\"Copy\">");
echo("</form>");
Then I have a jQuery handler for the submit
$('#target').submit(function() {
alert(this.ids); // *See note below
// I now want to call a PHP page, passing the array of ids so that this array can be used in a mySQL statement, then when complete notify the user it has succeeded
return false;
});
*If I give the checkbox group the name ids (name=\"ids\") rather than ids[] then this alert shows "[object NodeList]"
How should I handle this? many thanks