how let users select categories for posts in frontend?

here is how to do it:

    <form action="#" method="post">
        <input type="checkbox" name="checklist[]" value="1"><label>Blue</label>
        <input type="checkbox" name="checklist[]" value="2"><label>Red</label>
...
        <input type="submit" name="submit" value="submit"/>
    </form>
    <?php
        if(isset($_POST['submit'])){
            if(!empty($_POST['checklist'])){
                $selectArr = array();
                foreach($_POST['checklist'] as $selected){
                    $selectedInt = (int)$selected;
                    $selectArr[] = $selectedInt;
                    wp_set_object_terms( $thePostId, $selectArr, 'color');
                }
            }
        }
    ?>

where the values in input tags are taxonomies IDs (color IDs)

and I used my theme functions to define current Post ID ($thePostId)