1

I want to create a form in Drupal 7. User will select appropriate listbox, radio button options. When user clicks Submit button, form will post related values to another php file with GET arguments.

  • Default submit button shows a confirmation page for email sending/registration. I couldn't make the form to post arguments to a php file by changing submit behaviour of the form.

For two days I tried Webform module to do this. I would be happy if you can recommend me some way to make this? Examples, tryouts, modules, codes, etc

1 Answer 1

2

There are 'better' ways but this will do the trick in a custom module:

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  $nid = 1; // Or whatever the node ID of your webform is
  if ($form_id == 'webform_client_form_' . $nid) {
    $form['#action'] = 'my-script.php';
    $form['#method'] = 'get';
  }
}

Bear in mind of course that the original webform submission functions will not run so your webform data won't be saved to the database.

Sign up to request clarification or add additional context in comments.

2 Comments

* What can be "better" ways? are they hard to implement? * I couldn't find the form's id, where can i check it? * If I put my own form html to node, how can i change form submit value, or what should i write to action part of form, node address? Thank you
The 'better' ways are harder to implement, yes, it would involve using the Form API to build up your own form and then using the submission function to perform whatever task you needed to in your external script. You can check the webform's nid by going to it's edit page and looking at the url: node/NID/edit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.