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);
  • check can be done in $form_state variable – subhojit777 Jan 22 '13 at 11:02
  • where are you trying to check it? – Mohammed Shameem Jan 22 '13 at 11:04
up vote 2 down vote accepted

Like so:

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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