清理后置阵列?

I am very new to PHP and I am trying to add in precautions to my web form to avoid misuse, these inputs from the user are being stored to a database. I keep getting errors when trying to pass through the whole post array. I believe its to do with the checkboxes.

I have a function below:

function CleanArray($array) {

        return array_map('mysql_real_escape_string', $array);
}

I also have 2 input fields and a bunch of multiple check boxes.

Example:

 <input type="checkbox" name="decks[]" value="All Decks"/>
  <label>All Decks</label>
  <br>
  <input type="checkbox" name="decks[]" value="Competitor"/>
  <label>Competitor</label>

Now when I execute this code it flags up an error and wont output the multiple checkbox values (I have selected several).

$_POST = CleanArray($_POST);

Warning: mysql_real_escape_string() expects parameter 1 to be string,

So I decided to unset the the problem bit from the array, then clean it separately and add it back in the array. This works and I get all the data I need. I feel this is a lot of effort and is it really needed?

    $decks = $_POST['decks'];
    unset($_POST['decks']);
    $_POST = CleanArray($_POST);
    $decks = CleanArray($decks);
    $_POST['decks'] = $decks;

My output:

hello hello All Decks,Competitor,Misc,Partners and stakeholders,Process,Product,Structures and Roles

Any advice would be appreciated. I feel this is rooky error and maybe I don't understand the function enough.

Thanks Hayley