Page 1 of 1

Editing Checkbox

Posted: Fri Jun 09, 2006 4:28 am
by burnhallian
Hi All !

Im editing a php page and i have to retrive the value of a checkbox and im not sure how to get that :cry:
The part of the code is below. Kindly tell me how to get back the value of check box and display it on the page, this code displays the checkbox as checked always irrespective of whether it was selected or not.

Code: Select all

tr><td>
<input type="checkbox" name="dis6" value="1"<?php if(isset($row['dis6'])) echo 'checked';?>>

<font face="Arial" size="3">Integration & Customization </td></tr>

Posted: Fri Jun 09, 2006 4:45 am
by Oren

Code: Select all

<input type="checkbox" name="dis6" value="<?php echo $_POST['dis6'] . '"'; if(isset($row['dis6'])) echo 'checked'; ?>>
Edit: You should also change checked into checked="checked" if you want the code to be valid XHTML.