Better idea than triple nested switch?

Hi I've got some form for uploading files through php script, where user pick a one category, than second sub-category and then type of file.

I have to upload it on server into correct directory and path will looks like ..../category/sub-category/type/ --- and then I put whole absolute path to my database

By now I've got triple nested switch, is there any other way how to do it in better way?

Thanks a lot!

There is a pic of HTML code and PHP -- >


Not sure at what point does the switch come in. However, can't you just do something like following in a single statement?

$complete_filepath = "..../$category/$sub_category/$type/$filename";

May be a multi-demension array will help you to solve it. like this:

$arr_dir_conf = array("dir_conf" =>
    array("category1" => 
        array("sub_category1" =>
            array("type1" => "directory/category1/sub_category1/type1"),
            array("typen" => "directory/category1/sub_category1/typen")

        array("sub_categoryn" =>

Then you just use the array like this:


Need Your Help

calling a method on the parent page from a user control

c# user-controls methods

I am using a user control that I created (just a .cs file not an .ascx file), that does some magic and depending on a value generated by the control, I need it to do something on the parent page th...

How to: Keep track of Progress on questionnaire

android android-fragments saving-data android-sharedpreferences

Good day all, I am working on a practice app that involves fragments, keeping track of data, and SharedPreferences, Here is the scenario, I have a questionnaire-like app, it will ask the user 15