Advanced Search

Results 1 to 2 of 2

Thread: Help with populating checkboxes ...

  1. #1
    Join Date
    Nov 2008
    Posts
    33
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Help with populating checkboxes ...

    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>

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,593
    Thanks
    71
    Thanked 80 Times in 78 Posts

    Default

    Please put your code in code tags. It makes it easier to read.

    Could you post the string you are working with? With strpos what you are looking for is a number value, not a letter value.
    Code:
    $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.
    To choose the lesser of two evils is still to choose evil. My personal site

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •