2

I have a form on my site. Users fill out the form and submit it. When I want to target one of the fields in the form with a custom module I'd target it with something like the following:

$form['customer_profile_billing']['field_organization'];

But, if I want to target the value a user entered - after they clicked submit, in a custom module, what would be the proper syntax to use, or how would I figure out what my $POST variables are?

1 Answer 1

2

The submitted values are available in your custom validate/submit handler in the $form_state['values'] or $form_state['input'] (with the later one storing raw and unvalidated user input). I think this is considered better practice than accessing the values through the $POST variable.

1
  • 1
    Yes, $form_state['values'] is the preferred place to get posted form values 99.9% of the time.
    – rooby
    Commented Apr 15, 2016 at 6:07

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.