<td><input name="power" type="checkbox" disabled="disabled" <?php if($row['power_backup']=='on') echo "checked"; ?> /></td>
<td>Power Backup</td>
<td style="width:25px;"><input name="purifier" disabled="disabled" type="checkbox" <?php if($row['water_purifier']=='on') echo "checked"; ?> /></td>

I have some checkboxes ,what i am trying to do if a checkbox is checked(its value is on)
it should bold.

need suggestions.

Recommended Answers

All 4 Replies

<td>
<input name="power" type="checkbox" disabled="disabled" 
<?php if($row['power_backup']=='on') echo "checked"; ?> />
</td>
<td><?php if($row['power_backup']=='on') echo "<b>Power Backup</b>" else echo "Power Backup"; ?></td>

<td style="width:25px;">
<input name="purifier" disabled="disabled" type="checkbox" 
<?php if($row['water_purifier']=='on') echo "checked"; ?> />
</td>
<td><?php if($row['water_purifier']=='on') echo "<b>Water Purifier</b>" else echo "Water Purifier"; ?> </td>
<td>
<input name="power" type="checkbox" disabled="disabled" 
<?php if($row['power_backup']=='on') echo "checked"; ?> />
</td>
<td><?php if($row['power_backup']=='on') echo "<b>Power Backup</b>" else echo "Power Backup"; ?></td>

<td style="width:25px;">
<input name="purifier" disabled="disabled" type="checkbox" 
<?php if($row['water_purifier']=='on') echo "checked"; ?> />
</td>
<td><?php if($row['water_purifier']=='on') echo "<b>Water Purifier</b>" else echo "Water Purifier"; ?> </td>

I am trying to bold checkbox which is selected,can i do this
Need suggestion.

my code will bold text around checkbox.
if you want to change style of checkbox then create 2 style class and apply conditionally using php

checked is simular as disabled
so use

<td>
<input name="power" type="checkbox" disabled="disabled"
<?php if($row['power_backup']=='on') echo 'checked="checked"'; ?> />
</td>
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.