Guys, I know its easy to do it, but I'm having a hard time doing it. Please help me, I want to get the checked items in checkbox. The problem is that it gets the last value of it. I just used echo to get all the values, but how I can get all the values checkedd without using echo, and stored it in another variable. Thank You!
this is the html code
<input type="checkbox" name="sch[]" id="ra" <?php if(isset($sch)) echo "checked"?> value="sample a"/><label>ra sample</label><br><br>
<input type="checkbox" name="sch[]" id="rb" <?php if(isset($sch)) echo "checked"?> value="sample b" /><label>rb sample</label><br><br>
<input type="checkbox" name="sch[]" id="rc" <?php if(isset($sch)) echo "checked"?> value ="sample c"/><label>rc sample</label><br><br>
<input type="checkbox" name="sch[]" id="rd" <?php if(isset($sch)) echo "checked"?> value="sample d/><label>rd sample</label><br><br>
<input type="checkbox" name="sch[]" id="re" <?php if(isset($sch)) echo "checked"?> value="sample e"/><label>re sample</label><br><br>
<input type="checkbox" name="sch[]" id="rf" <?php if(isset($sch)) echo "checked"?> onclick="txtShow('txtOSchProg')"/><label>others</label><br><br>
this is the php code
for($i=0;$i<$n; $i++)
{
$sch = $_SESSION['schp'][$i]. "; ";
echo $sch;
}