I've got a posting system on my small Wordpress through which customers can choose groups from two drop-lower menus - first drop-lower being top level category, and 2nd drop-lower being sub-groups for that selected top level category.

My question at this time would be that the posts aren't being categorized properly whatsoever. They keep getting put in the very first top level category within the top level category list. I believe the problem is based on my lack of ability to on-site visit caused by the chosen category effectively.

The HTML form appears like the next within the adding-publish php page:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript">
$(function(){
            $('#main_cat').change(function(){
                    var $mainCat=$('#main_cat').val();

                    // call ajax
                     $("#sub_cat").empty();
                                                $.ajax({
                                                        url:"<?php bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php",     
                                                        type:'POST',
                                                        data:'action=my_special_ajax_call&main_catid=' + $mainCat,

                                                   success:function(results)
                                                       {
                                                        //  alert(results);
                                                        $("#sub_cat").removeAttr("disabled");       
                                                          $("#sub_cat").append(results);
                                                        }
                                                   });



                                          }
                                          );
});                                       
                                          </script>
<?php 
wp_dropdown_categories('show_count=0&hierarchical=1&depth=1&hide_empty=0&show_option_none=Select Topic&name=main_cat');
?>
<select name="form[sub_cat]" id="sub_cat" disabled="disabled" ></select> 

The function in function.php for that AJAX menu appears like this:

function implement_ajax() {
if(isset($_POST['main_catid']))
            {
            $categories=  get_categories('child_of='.$_POST['main_catid'].'&hide_empty=0'); 
              foreach ($categories as $cat) {
                $option .= '<option value="'.$cat->term_id.'">';
                $option .= $cat->cat_name;
                $option .= ' ('.$cat->category_count.')';
                $option .= '</option>';
              }
              echo '<option value="-1" selected="selected">Select Category</option>'.$option;
            die();
            } // end if
}
add_action('wp_ajax_my_special_ajax_call', 'implement_ajax');
add_action('wp_ajax_nopriv_my_special_ajax_call', 'implement_ajax');//for users that are not logged in.

if ( function_exists('register_sidebar') ) {
    register_sidebar(array(
        'before_widget' => '<li id="%1$s" class="widget %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h2 class="widgettitle">',
        'after_title' => '</h2>',
    ));
}

And lastly, the code I'm using to on-site visit caused by the course selection is:

<?php echo ($_POST['form']['sub_cat']); ?>

If anyone can offer any help that might be excellent! I've been studying this for more than three days :'(

Thanks! Kayla