Page 1 of 1

Help with populating checkboxes...

Posted: Thu Apr 08, 2010 12:25 pm
by pepe_lepew1962
I am having problems with populating checkboxes. After I call up a record, one of the fields has a bunch of characters that I use to determine which checkboxes to populate on the form. I extract each character via "strpos" to variables. I then have the checkbox form check if the status is "on". That all seems to work fine until I want to change the status of the checkboxes. The change is somehow not being taken over. I know how to update the record of the change, but I have to be able to change the fields/variables first.

Code: Select all

<?php
//
//
$pepe01 = strpos($pepe00, "A");
$pepe02 = strpos($pepe00, "B");
//
//
    if ($pepe01 == "A")
    {
        $pepe11 = "on";
    }
//
//
?>
<html>
<tr>
    <td align="left" width="35"><font color="#00ff00" face="Arial" size="2">&nbsp;</font>
        <input type="checkbox" name="checkbox01" <?php if($pepe11 == "on"){echo "CHECKED";}?>></td>
    <td align="left"><font color="#00FF00" face="Arial" size="2">&nbsp; Alex</font></td>
</tr>
</html>

Re: Help with populating checkboxes...

Posted: Fri Apr 09, 2010 10:43 pm
by jthermane24
The proper syntax for CHECKED is checked="checked"

Change the echo in your php script in the input