I have an item that I get from the database, it's a string separated by commas. To get the individual pieces I use the explode command. I would like the array index to be the same value as the exploded pieces. How can I do that? I imagine I would have a for each loop? Any suggestions? Here's what I have so far: [code] $query = "SELECT name, address, type FROM member m INNER JOIN profile p ON "; $query .= "m.memberID = p.memberID WHERE m.memberID = '".$sessUserID."'"; $dbResults = mysql_query($query); $result = mysql_fetch_array($dbResults); $pieces = explode(",", $result['type']); print_r ($pieces); [/code] [u]Output[/u] Array ( [0] => 1 [1] => 5 [2] => 10 [3] => 12 ) [u]What I want the array to look like is this[/u]: Array ( [1] => 1 [5] => 5 [10] => 10 [12] => 12 ) [u]Ultimately, I have a group of checkboxes on a form[/u]: <input name="type[]" type="checkbox" value="1" /> <input name="type[]" type="checkbox" value="2" /> <input name="type[]" type="checkbox" value="3" /> ........ <input name="type[]" type="checkbox" value="14" /> Pretty much, I need to match the values in the array with the checkboxes -- if there is a match then display that checkbox as "checked". So according to the array results in the above example the checked check boxes would be: <input name="type[]" type="checkbox" value="1" checked="checked" /> <input name="type[]" type="checkbox" value="5" checked="checked" /> <input name="type[]" type="checkbox" value="10" checked="checked" /> <input name="type[]" type="checkbox" value="12" checked="checked" />