Jump to content

Article management - Category, subcategory - Checkbox


pospan

Recommended Posts

Hello Community,
 
I have some diffuclties about getting the right logic for article management with subcategories. So everything with Categorys is fine.
 
TABLE: articles    
articleID
    title
    content
    cat_relatedID
 
TABLE: categories 
    catID
    cat_name
 
On submit it Works fine where in "selection option" I can select the Category for that post. Now I want to extend it with subcategories.
 
TABLE: articles      
    articleID
    title
    content
    cat_relatedID
 
TABLE: categories     
    catID
    cat_name
 
TABLE: subcategories 
    subcatID
    subcat_name
    related_catID
 
Now the problem is how to relate Cats and Subcats in the form where I am adding new Articles and submit it to mysql. Do I need a additional field in the article table subcatID or anything else? My logic is something to make like in Wordpress when adding New posts you have the option to check categories related with that post. 
 
 

    <ul class="list-unstyled categorychecklist ">
        <li><input type="checkbox" value=""> Category 1
            <ul class="children">
                <li><input type="checkbox" value=""> Subcategory 1</li>
                <li><input type="checkbox" value=""> Subcategory 2</li>
                <li><input type="checkbox" value=""> Subcategory 3</li>
            </ul>        
        </li>    
        <li><input type="checkbox" value=""> Category 2
            <ul class="children">
                <li><input type="checkbox" value=""> Subcategory 4</li>
                <li><input type="checkbox" value=""> Subcategory 5</li>
                <li><input type="checkbox" value=""> Subcategory 6</li>
            </ul>        
        </li>
        <li><input type="checkbox" value=""> Category 3 - No subcategories</li>
    </ul>  

 LINK should look something like this example:

 mylink.com/category.php?ID=12&sub_ID=15

 

Image attached is how it looks now.

post-192985-0-12405400-1453979979_thumb.jpg

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.