Hi,

I am trying to get the value of a dropdown select and then run some code using SELECT CASE

Any help here much appreciated...

here is my code:

function amr_reports_anonymise_form() {
  $form['option'] = array(
    '#type' => 'select',
    '#title' => t('Option'),
    '#options' => array('sponsor' => t('Sponsorships'), 'donations' => t('Donations'), 'registrations' => t('Registrations')),
    '#required' => TRUE,
  );
  // $form['date'] = array(
  //   '#type' => 'date',
  //   '#title' => t('Date'),
  //   '#required' => TRUE,
  // );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Process'),
  );
  return $form;
}

function amr_reports_anonymise_form_submit($form, $form_state) {
  $type = $form_state['values']['type'];
  echo $type;
  switch ($type) {
    case "sponsor":
      echo "sponsorships";
      break;
    case "donations":
      echo "donations";
      break;
    case "registrations":
      echo "Registrations";
      break;
    default:
      echo "sponsor";
  }
  echo $type;
  return $type;
}