Form Input, SQL and Sub-Categories :S

Discussion in 'PHP' started by Rory M, Jul 31, 2008.

  1. #1
    Hi,

    I am setting up a script for myself that (hopefully) will let users submit to various categories.

    The problem I am having is in the way that categories are arranged.

    Visually, they are like this:

    Etc, etc.

    This works fine when I am echoing to the browser but is causing me loads of hassle on the submit page.

    What I want is to have a drop down box of all categories in their Hierarchal order within that box.

    Eg. Sub Cat 1 should be indented and below Main cat 1.

    The table in question is setup so each field has an ID and a ParentID. The ParentID corresponds to the ID of a higher table.

    I would love to know how the coding geniuses out there have managed to order the results before sending them to the input box.

    Thanks
    Rory
     
    Rory M, Jul 31, 2008 IP