Getting multiple value using the same Check Box name
For example when a form contains multiple checkboxes with the same name, multiple input an be retrieved using the following PHP code.
Sample PHP Code
<?php
$strExpert=”";
if(isset($hidSubmit)){
$count=count($chkexpert);
for($i=0;$i<$count;$i++){$strExpert=”$strExpert$chkexpert[$i], “;}
}
?>
Sample HTML Code for the above example
<form name=”form1″ method=”post” action=”"> <table width=”100%” border=”0″>
<form name=”form1″ method=”post” action=”"> <table width=”100%” border=”0″><tr><td>Your are Expertise field: </td></tr>
<tr>
<td><input type=”checkbox” name=”chkexpert[]” value=”PHP”>PHP
<input type=”checkbox” name=”chkexpert[]” value=”.NET”>.NET
<input type=”checkbox” name=”chkexpert[]” value=”Java”>Java</td>
</tr>
<tr>
<td><input type=”submit” name=”Submit” value=”Submit”>
<input name=”hidSubmit” type=”hidden” id=”hidSubmit2″ value=”true”></td>
</tr>
<tr>
<td><p>Result:</p>
Your Expertise field: <?php echo $strExpert; ?></td></tr>
</table>
</form>
