I have problem to insert value of fields as checkbox checked .

please help me.

<ol  >
	<?php
	$i = 0;  
   $sql="SELECT * FROM import_master WHERE mawb='".trim($_GET['id'])."' ORDER BY conzName";
    $rs=mysql_query($sql);
    while($row = mysql_fetch_array($rs))
    {							   
    ?>
    <li>
           <div><table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable">
            <tr>
            <td class="label" >
            <input type="checkbox" id="chb[]" name="chb[]"  value="<?php echo $i++;?>" /></td>  
            <td width="804" class="label" colspan="2">
            Conz.Name &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="conzname[]" type="text" class="box" id="conzname[]" size=            "20" maxlength="255" value="<?php
			 echo $row['conzName'];?>" /><br/>
            Conz.Adress &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<textarea name="address[]" id="address[]" cols="30" rows="4"><?php echo $row['conzAddress'];?></textarea><br/>
            pkgs.No &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="pkgsno[]" 
            type="text" class="box" id="pkgsno[]" size="20" maxlength="255" value="<?php echo $row['pkgsNo'];?>" /><br/> 
           <!-- Retrieved By &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="retrievedby" type="text" class="box" id="retrievedby"            size="20" maxlength="255" value="<?php echo $row['conzName'];?>"/>
            <br/>
            Packed By &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="packedby" type="text" class="box" id=            "packedby" size="20" maxlength="255" value="" /><br/> -->
            </td>
            </tr>
            </table>
            </div>
		<?php
        }
        ?>
	</ol>

you can use echo to do this.

eg

<input type="checkbox" name="something" <?php if ($i=1){ echo "checked";)/>

This is a way to do it, but I would amend it to

<input type="checkbox" id="chb[]" name="chb[]"  value="<?php echo $i++;?>" <?php if ($i=1){ echo "checked=\"checked\" ";)/>
Be a part of the DaniWeb community

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