Checkboxes
Posted: Mon Jul 16, 2007 4:10 am
Inorder to use checkboxes in php, i use something like the following:
It is perfectly alright if I want to manipulate data based on this selection[] array but how would I send this as a variable to another php script using Ajax.
in Ajax i use something like:
But it says selection has no properties in the Javascript Error Console... Is there a workaround for this or am i using everything in an incorrect way?
PS: This script contains both PHP and Ajax so I was confused where to post it. I'm sorry if this is the wrong forum...
Code: Select all
<input type="checkbox" name="selection[]" value="<?php echo $row[$i] ?>" /> Check box 1
<input type="checkbox" name="selection[]" value="<?php echo $row[$i] ?>" /> Check box 2
<input type="checkbox" name="selection[]" value="<?php echo $row[$i] ?>" /> Check box 3
<input type="checkbox" name="selection[]" value="<?php echo $row[$i] ?>" /> Check box 4
<input type="checkbox" name="selection[]" value="<?php echo $row[$i] ?>" /> Check box 5in Ajax i use something like:
Code: Select all
var e_id = document.getElementById('selection').value;
var queryString = "?e_id=" + e_id;
ajaxRequest.open("GET", "cc/fs.php" + queryString, true);
ajaxRequest.send(null);PS: This script contains both PHP and Ajax so I was confused where to post it. I'm sorry if this is the wrong forum...