0

how i can knowing if the checkbox is checked or not on the form

function darksite_config_page() {
  $form['darksite_status'] = array(
    '#title' => t('Enable pop up screen'),
    '#description' => t('When enabled, a pop up screen will be displayed on the home page.'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('darksite_status', 0)
  );

  return system_settings_form($form);
}
2
  • check can be done in $form_state variable Commented Jan 22, 2013 at 11:02
  • where are you trying to check it? Commented Jan 22, 2013 at 11:04

1 Answer 1

2

Like so:

if (variable_get('darksite_status', 0)) {
  // Yes.
}
else {
  // No.
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.