I have form where I'm displaying checkboxes with data taken from a MySQL table
- PHP: Select all
<?
$selectint = mysql_query("select * from interets order by interet asc");
while ($rowint = mysql_fetch_array($selectint)) {
$interet = stripslashes($rowint['interet']);
$iID = $rowint['iID'];
?>
<input type="checkbox" name="iID" id="interets" value="<?=$iID?>" /> <?=$interet?><br />
<?
} ?>
which displays this when you view the source online
- HTML: Select all
<input type="checkbox" name="iID" id="interets" value="1" /> Activités de réseautage<br />
<input type="checkbox" name="iID" id="interets" value="3" /> Coaching<br />
<input type="checkbox" name="iID" id="interets" value="6" /> Comité amélioration physique<br />
<input type="checkbox" name="iID" id="interets" value="8" /> Comité développement écon.<br />
<input type="checkbox" name="iID" id="interets" value="7" /> Comité marketing<br />
<input type="checkbox" name="iID" id="interets" value="2" /> Formations et ateliers gratuits divers<br />
<input type="checkbox" name="iID" id="interets" value="5" /> Implication comme bénévole<br />
<input type="checkbox" name="iID" id="interets" value="4" /> Publicité commune<br />
What I wanted to do was to store the results like this
1-3-7
I think this is the easiest way...
What I want to know is, then user clicks submit, how do go about grabbing the ones that were checked and putting them in the format above?