Inserting multiple checkbox values into a field

Hi, I have a form of which one element is a series of checkboxes. I want to be able to tick multiple checkboxes and have the values stored in the db. I’m guessing I need to turn them into an array somehow, but I don’t really know how to do it and if I’d need to change my function code?

Here’s what I have:


<?php
// Add a record
	function add_record($params)
	{
	  $connection = db_connect();		
	  $query = sprintf("insert into records set 
                                         Name = '%s',
	                                     Number = '%s',
										 Colours = '%s'", 
							mysql_real_escape_string($params['Name']),
							mysql_real_escape_string($params['Number']),
							mysql_real_escape_string($params['Colours'])
                            );		
	  $result = mysql_query($query);
		if (!$result)
		{
		  return false;
		}
		else
		{
		  return true;
		}		
	?>
<input type="checkbox" name="Colours" value="Red"  />Red
<input type="checkbox" name="Colours" value="Blue"  />Blue
<input type="checkbox" name="Colours" value="Green"  />Green
<input type="checkbox" name="Colours" value="Yellow" />Yellow
<input type="checkbox" name="Colours" value="Black"  />Black
<input type="checkbox" name="Colours" value="White" />White

You can have the checked values put into a $_POST array like so:

<input type="checkbox" name="Colours[]" value="Red"  />Red
<input type="checkbox" name="Colours[]" value="Blue"  />Blue
<input type="checkbox" name="Colours[]" value="Green"  />Green
<input type="checkbox" name="Colours]" value="Yellow" />Yellow
<input type="checkbox" name="Colours[]" value="Black"  />Black
<input type="checkbox" name="Colours[]" value="White" />White