How about this:
<form method="post" action="">
Pick up your hobby :<br />
<input type="checkbox" name="hobby1" value="Fishing" />Fishing<br />
<input type="checkbox" name="hobby2" value="Reading" />Reading<br />
<input type="checkbox" name="hobby3" value="Sleeping" />Sleeping<br />
<input type="checkbox" name="hobby4" value="Eating" />Eating<br />
<input type="checkbox" name="hobby5" value="Swimming" />Swimming<br />
<input type="submit" name="submit" value="Submit" />
</form>
And part of the PHP Codes :
/* ############################# */
$amount = 5; // Amount of checkboxes
$prefix = "hobby"; // prefix for checkboxes (before numeric identifier)
$holder = array();
/* Arraying checkboxes result */
for ($i=1;$i<=$amount;$i++){
if($_POST[$prefix.$i] != ''){
$holder[] = $_POST[$prefix.$i];
}
}
$result = implode(",", $holder);