multi select option printing
<p>I am just a beginner in php. 
I am trying to print the values of the form when submitted. I used the following code for hobbies which is a field of my form.</p>

<pre><code>&lt;?php
    $hobbies=array("Reading books","Listening to music","Swimming","Watching TV");

foreach($hobbies as $key=&gt;$value) {
    $hobbyvalues='&lt;input name="hobbies" type="checkbox" value="'.$value.'" /&gt;'.$value."&lt;/br&gt;";
    echo $hobbyvalues;
}
?&gt;
</code></pre>

<p>I store the selected hobbies like the following.</p>

<pre><code>$hobbies = $_POST["hobbies"];
echo $hobbies;
</code></pre>

<p>I checked it by selecting more than one hobby and submit the form. But my result prints only the last selected hobby. </p>

<p>I need my code to display all the selected hobbies. How can i do that?</p>
