When updating categories in an existing category should not appear in the drop-down list

I am trying to create a drop-down list for a blog category using php, and when editing a category form it should not display the existing category name that I need to update in the category.

Example: I have electronics for products under this category. I have a laptop and a mobile phone, if I update the mobile phone in the drop-down list of the mobile phone should not be displayed. thanks in advance

Now the form is as follows

The second form in which I highlight the "laptop" keyword, and its editing should not be displayed

<select name="category" class="field" style="width:160px" > <option value="0">Select</option> {var name='cat_ops'} </select> if ($_GET['action'] == 'edit' && $_GET['id']) { $sel_cat =$cate_id ; } else { $sel_cat = ""; } construct_cat_ops($sel_cat); $tmpl->setvar('cat_ops', $cat_ops); 
+5
source share
2 answers
  if ($_POST['update'] && $_POST['hid_id']) { if($brand==$categoryname){ $msg = "Parent category cannot be same"; $tmpl->setvar('msg_err', $msg); }else{ $db->query("Update `blog_category` set`name`='$brand',`parent`='$category' where id='" . $_POST['hid_id'] . "'"); $msg = "Blog category Updated Successfully"; $tmpl->setvar('msg_ok', $msg); $tmpl->setvar('name', $brand); } } 
+1
source

I think that your code should be, one way or another, I do not know that the php code is in a separate file and the html / tpl code in a separate file.

 if ($_GET['action'] == 'edit' && $_GET['id']) { $sel_cat =$cate_id ; } else { $sel_cat = ""; } construct_cat_ops($sel_cat); $tmpl->setvar('cat_ops', $cat_ops); <select name="category" class="field" style="width:160px" > <option value="0">Select</option> {var name='cat_ops'} </select> 
+1
source

All Articles