Log in

View Full Version : Help with populating checkboxes ...



pepe_lepew1962
04-08-2010, 05:31 PM
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.
<?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>

james438
04-10-2010, 05:21 AM
Please put your code in code tags. It makes it easier to read.

Could you post the string you are working with? With strpos (http://php.net/manual/en/function.strpos.php) what you are looking for is a number value, not a letter value.

$pepe01 = strpos($pepe00, "A");
$pepe02 = strpos($pepe00, "B");
$pepe01 will now equal a number value, not a letter value. In this case $pepe1 will always be false.