from a HTML from users can select subjects under different categories. after selected subjects I have save them on session. Its OK. I did it like this...

```
$_SESSION['select-subjectes'] = $_POST['select-subjectes']; 

```

This is the result of `echo '<pre>', print_r($_SESSION['select-subjectes']), '</pre>';`

```
    Array
(
    [Grade 5 (Scholarship Exam)] => Array
        (
            [0] => 3:2
            [1] => 3:3
        )

    [Grade 11 (O/L)] => Array
        (
            [0] => 5:8
            [1] => 5:10
        )

    [Graduation Level] => Array
        (
            [0] => 7:24
            [1] => 7:46
            [2] => 7:82
        )

)

```

Now I need to get this values to insert to the database. `3:2` this kind of value mean is the number before colon are category ids and the number after colon are subject ids. My problem is when I try to get this values respectively to insert to the database. 

I tried something like this.. but its not working..

```
if ( isset($_SESSION['select-subjectes'])) {                        
    $data = array();
    $data = $_SESSION['select-subjectes'];

    foreach($data as $key => $value) {

        $pieces = explode(":", $value);
        $catId = $pieces[0];
        $subId = $pieces[1];

        $q = "INSERT INTO category_subject ( category_id, subject_id ) VALUES ( ?, ? )";            
        $stmt = mysqli_prepare( $dbc, $q );         
        mysqli_stmt_bind_param( $stmt, 'ii', $catId, $subId );          
        mysqli_stmt_execute( $stmt ); 
    }       
}

```

Hope someone help me out about this.. 
Thank you.