0

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>

Edited by Ezzaral: Fixed duplicated code.

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by tiggsy
0

you can use echo to do this.

eg

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

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\" ";)/>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.