array returns checked items only?
Posted: Tue May 30, 2006 6:02 pm
I'm using an array of items in a form with a checkbox on each row of items to indicate that the row should be included upon submission of the form...
My other arrays like amount[] are passed just fine but the doInclude[] array is passed with only the checked items and with keys that don't match up to the other arrays. For example, if two items out of many possible items are checked, print_r($doInclude) returns:
Array ( [0] => on [1] => on )
regardless of the rows that are checked, which is pretty useless.
The items are not in a table. The use of this method for returning arrays of variables from a form was suggested earlier in this forum and has proven usefull, but this has me stuck.
Any thoughts?
Rob
Code: Select all
while($row = mysql_fetch_array($deposits)){
print("<div class=depositslip>");
print("<INPUT TYPE=checkbox NAME=\"doInclude[]\" CHECKED>");
print("<INPUT TYPE=hidden NAME=\"amount[]\" value=\"$row[0]\">");
...Array ( [0] => on [1] => on )
regardless of the rows that are checked, which is pretty useless.
The items are not in a table. The use of this method for returning arrays of variables from a form was suggested earlier in this forum and has proven usefull, but this has me stuck.
Any thoughts?
Rob