Forum Moderators: coopster
.......
print"<td valign=center bgcolor=\"#99CCFF\"> <div align=center><input type=checkbox name=review[] value=$search> Review</div></td>\n";
print"</tr>\n";.......
When I click on my submit button to go to the next page to review the entries that were selected by checking the review check box all I get is this:
Code:
echo "<pre>";
print_r($_POST); // or $HTTP_POST_VARS if you have older PHP
echo "</pre>";
Output:
Array
(
[review] => Array
(
[1] => GMWA.EXE
[5] => GMWA202.PBD
[6] => GMWA203.PBD
[10] => PBO7360.DLL
[11] => PBRTC60.DLL
)
[view] => Review
)
How would I work with the values in the array. I have tried everything that I know, but I don't get the correct variables.
Thanks for any help that anyone can provide.
If you need the array to match other data on a one-to-one basis, ie. taking into account the unchecked boxes, then one solution is to have an ID associated with each checkbox.
You can name the checkboxes as follows:
<table>
<input type="hidden" name="IDSet[]" value="1">
<input type="checkbox" name="checkbox1" value="$search">
</table>
<table>
<input type="hidden" name="IDSet[]" value="2">
<input type="checkbox" name="checkbox2" value="$search">
...
...
<table>
<input type="hidden" name="IDSet[]" value="53">
<input type="checkbox" name="checkbox53" value="$search">
</table>
then in your php:
<?
$countLoop = count($IDSet);
for ($i = 0; $i < $countLoop; $i++)
{
// Get ID
$id = $IDSet[$i];
// Get checkbox value associated with ID
$checkboxName = 'checkbox'.$id;
$checkboxValue = $$checkboxName;
// Do other stuff
}
?>