PHP & MySQL question

senifitteed

New Member
When I delete a category that has been unchecked form the list of checkboxes the checkedbox remains checked until I leave the page and return to it again but I want the checkbox to be unchecked after it has been deleted when the user submits there changes. How can I do this?Here is my PHP code.\[code\]for ($x = 0; $x < count($query_cat_id); $x++){ if($query_cat_id[$x] == $cat['id']){ echo 'checked="checked"'; } if(isset($cat_id)){ if(!in_array($query_cat_id[$x], $cat_id)){ $mysqli = mysqli_connect("localhost", "root", "", "sitename"); $delete_id = mysqli_query($mysqli,"DELETE FROM articles_categories WHERE article_id = '" . $article_id . "' AND category_id = '". $query_cat_id[$x] ."'"); if (!$delete_id) { print mysqli_error($mysqli); } } }}\[/code\]
 
Back
Top