am trying to build up the contents of an array so that i can store the final result into mysql. below i have sample checkboxes and the final result that i need to store. i am sure i can do this with a simple loop but i would end up with 'red','green','blue', as a result and not 'red','green','blue' like i need.
anyone have any suggestions?
<form method="get" action="test.php">
<input type="checkbox" name="colors[]" value="red" /> Red
<input type="checkbox" name="colors[]" value="blue" /> Blue
<input type="checkbox" name="colors[]" value="green" /> Green
<input type="checkbox" name="colors[]" value="yellow" /> Yellow
<input type="submit" name="go" value="go">
</form>
<?php
if($colors) {
foreach ($colors as $key=>$value) {
echo "'{$colors[$key]}',";
}
}
?>