Jump to content

PHP, FMP and Checkboxes using FX


evild
 Share

This topic is 6530 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I'm have a bit of trouble making checkboxes send back what has been checked to the FMP db.

In FMP, I've set up one Field (FIELDNAME) as 'checkboxes' with a 6 item Value List (myValueList). I can read/display the correct items from the db, but I'm not sure how to get it back into the db once changes have been made.

// i explode $formInfo['FIELDNAME'][0] because FX sees the contents of

// that field as: items checked with a newline inbetween each item

$checkboxParts = explode("n", $formInfo['FIELDNAME'][0]); // $formInfo is [data] array from FX



$cbList = $allLists['myValueList']; // $allLists is [valueLists] array from FX

    foreach ($cbList as $cbChoice) {

        foreach ($checkboxParts as $checkboxSelected) {

            if ($cbChoice == $checkboxSelected) {

                $selection = " CHECKED";

                break;

            } else {

                $selection = "";

            }

        }

   $cboptions .= "<input id="boxes" type="checkbox" name="FIELDNAME" value="yes"" . $selection . " /> " . $cbChoice . "<br />n";

    }

print "$cboptions";

	?>  

It works if I make each checkbox it's own Field with it's own 1 item Value List.

Any suggestions/solutions?

D

Link to comment
Share on other sites

This topic is 6530 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.