PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

test checkbox value

  1. pauldewouters
    Member

    using the gform_after_submission action, I'm retrieving the values of the $entry variable.
    I could get the value from a textbox and a radio group, but how do I get it from a checkbox?
    radio group:
    if($entry[1] == 'choice 1')
    // do something
    elseif($entry[1] == 'choice 2')
    //do something else

    this works with radio buttons

    Posted 13 years ago on Saturday September 3, 2011 | Permalink
  2. Checkbox values are more complex. I would dump the $entry variable (with print_r or equivalent) to get the actual names of the entries you need.

    Posted 13 years ago on Saturday September 3, 2011 | Permalink
  3. pauldewouters
    Member

    thanks, I figured it out:
    using $entry[3.1] doesn't seem to work, but when wrapping it in quotes, it does
    $entry['3.1'] = '1'
    and I set the checkbosx to have a value in the form settings

    Posted 13 years ago on Saturday September 3, 2011 | Permalink
  4. Right; 3.1 is a string not an integer, so it should be wrapped in quotes. Glad you got that figured out.

    Posted 13 years ago on Sunday September 4, 2011 | Permalink

This topic has been resolved and has been closed to new replies.