Link to home
Start Free TrialLog in
Avatar of Cheryl Lander
Cheryl LanderFlag for United States of America

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['catid']])

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";
        }
        ?>

Open in new window

Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

How is defined $assignedHash?
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh, yes... bhe, hielo is hielo...:-)
Avatar of Cheryl Lander

ASKER

Awesome guys.