Cheryl Lander
asked on
php and undefined index
I have some code below which retrieves values from mysql and outputs them as a series of checkboxes.
This works fine.
Only problem is if a value inst checked (ticked) it comes up with an error of
Notice: Undefined index: 198 in C:\wamp\www\edit_item.php on line 207
Line 207 = if($assignedHash[$row['cat id']])
Any help would be appreciated.
This works fine.
Only problem is if a value inst checked (ticked) it comes up with an error of
Notice: Undefined index: 198 in C:\wamp\www\edit_item.php on line 207
Line 207 = if($assignedHash[$row['cat
Any help would be appreciated.
<?php
$query = 'SELECT catid, catname FROM categories ORDER BY pageorder';
$ret = mysql_query($query) or die('Cannot execute query');
while ($row = mysql_fetch_assoc($ret)) {
$checked = "";
if($assignedHash[$row['catid']])
$checked = " checked='checked'";
echo "<label><input type='checkbox' name='catid[]' value='{$row['catid']}' {$checked}/> {$row['catname']} - {$row['catid']}</label><br />\n";
}
?>
How is defined $assignedHash?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oh, yes... bhe, hielo is hielo...:-)
ASKER
Awesome guys.