Hi all,
Hopefully a simple one for you. I am gathering a selection of ID's from my database and storing these id's into a session array:
$_SESSION['S_APPROVAL_IDS'][]
Further down my page, i run a check to see if an ID from a 2nd query exists in my session array, and if it does, I want to display a 'checked' checkbox, and if it doesn't, obviously display an 'unchecked' checkbox.
Here is a snippet of that code:
while ($datarow = mysql_fetch_array($result)) {
$approvalid = $datarow['approvalid'];
if (in_array($approvalid, $_SESSION['S_APPROVAL_IDS'])) {
$checkbox = "<input checked name=\"appselected\" type=\"checkbox\" class=\"appcheckbox\" value=\"1\" onclick=\"CountSelectedApprovals(document.centreapprovals);\" />";
} else {
$checkbox = "<input name=\"appselected\" type=\"checkbox\" class=\"appcheckbox\" value=\"1\" onclick=\"CountSelectedApprovals(document.centreapprovals);\" />";
}
The problem I am having is that even though I know the ID does actually exist in my session array, i my checkbox will still not display the checked value.
I have used print_r to display the contents of my session array which proves I have the id in my array:
Array
(
[0] => Array
(
[0] => 243101
[approvalid] => 243101
)
[1] =>
)
Does anyone have any suggestions as to why the checkbox is always unchecked?
Thanks in advance.
k