0

I can see the values submitted in the $_POST, so I know they are there, but when I uses a submit handler to retrieve them, I get NULL. I'm fairly new to PHP so not sure if it's a simple syntax mistake or something more. Thanks.

function zendesk_forms_form_alter(&$form, &$form_state, $form_id){

  if ($form_id == 'webform_client_form_47') {

    $form['#submit'][] = "zendesk_forms_support_form_submit_handler";
  }
}

function zendesk_forms_support_form_submit_handler($form, &$form_state) {
  form');
  $ticket = array(
      'description' => $form_state['values']['description'],
      'subject' => $form_state['values']['subject'],
  );
  echo $ticket;

enter image description here

2 Answers 2

0

Try this:

$ticket = array(
  'description' => $form_state['values']['submitted']['description'], 
  'subject' => $form_state['values']['submitted']['subject'],
);
2
  • I've tried this before but get the same result. Thanks.
    – ZST
    Commented Feb 26, 2018 at 19:03
  • I would dump $form_state['values'] into an email, file, or the watchdog log and see what it contains.
    – Geat
    Commented Feb 26, 2018 at 19:55
0

I figured it out. Thanks to https://drupal.stackexchange.com/users/70895/geat for the advice of dumping the ['values']. I was able to access the values by key.

$ticket = array(
    'comment' => array(
      'description' => $form_state['values']['submitted'][6],
      'subject' => $form_state['values']['submitted'][5],
    ),
  );

enter image description here

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.