How to apply readonly inside forloop in checkbox or disabled checked values in checkbox ramaining empty values will be active
any body help me

<input type="checkbox"  class="chkNumberck" value="<?php echo $sub_id; ?>"  
<?php  for($i=0;$i<$count1;$i++) {
if($sub_id1[$i]==$sub_id){
echo "checked"; 
}
}
?> 
/>

Recommended Answers

if (isset($_POST['chkNumberck'])) $returnArray=$_POST['chkNumberck'];
else $chkNumberck= array();
$count=5;

echo"<form action='test.php' method='post'>";
for ($sub_id=0 ;$sub_id < $count;$sub_id+=1) 
    {
    echo "<input type='checkbox' name='chkNumberck[]'  value=$sub_id "; 
    if (in_array($sub_id,$chkNumberck)) echo"checked='checked'";>
    }
echo "<input type='submit' /></form>";
Jump to Post

All 2 Replies

if (isset($_POST['chkNumberck'])) $returnArray=$_POST['chkNumberck'];
else $chkNumberck= array();
$count=5;

echo"<form action='test.php' method='post'>";
for ($sub_id=0 ;$sub_id < $count;$sub_id+=1) 
    {
    echo "<input type='checkbox' name='chkNumberck[]'  value=$sub_id "; 
    if (in_array($sub_id,$chkNumberck)) echo"checked='checked'";>
    }
echo "<input type='submit' /></form>";

Thnx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.