I have a simple form, presenting an "Order this" button. That form is placed on a node. When people press that button, I want to start an ordering-workflow.

Currently the Drupal-way seems to be:

  • Add form to node on node/123,
  • User clicks form-submit, POST goes to node/123.
  • hook_form_submit() gets fired, receives POSTed values trough form API.
  • In that function, the POSTed-data is stored in a Session; then a drupal_goto() sends redirect-header to /shop/checkout, user GETs /shop/checkout.
  • Code building the /shop/checkout page must retrieve information from Session to build the checkout-workflow.

How can I simply send the POST to /shop/checkout and present my HTML there, based on the POST, instead of all the intermediate goto and session-spaggetti?

1 Answer 1


The trick is to simply set $form['#action'] to whatever URL you want to POST to.

Like this:

$form = array(
  //..build the FAPI array
$form['#action'] = "shop/checkout";
return $form

In the place where you build the form. And the POST is sent to "shop/checkout".

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.