Webform - Submit values from Drupal 7 from to external url I am a self-proclaimed newbie to creating forms in Drupal.  I have a form hosted on a Drupal 7 website (using the webform module) and need to submit the form values to an external url. I've been researching this for awhile now and wrote a custom module that uses the webform module to submit externally using hook_form_alter and custom submit handler/function (code pasted below). 

I've been using the following pages as guides, but I haven't been able to get the form to work:
https://drupal.org/node/1357136
Using drupal_http_post() to submit to external site: What am I doing wrong?

Can someone let me know if I'm on the right track?  Any guidance would be helpful!

&lt;?php
function webform_extra_form_alter(&amp;$form, &amp;$form_state, $form_id)                 
{
   //only want form with nid 1171 to submit externally 
   //Note that "webform_client_form_1171" means modify the Webform form for the node with NID "1171". Adjust to match whichever webform node's form you're modifying
   if($form_id == 'webform_client_form_1171') 
       {
            $form['#action'] = url('https://[url path to external site]');
            $form['#attributes'] = array('enctype' =&gt; "application/x-www-form-urlencoded");
            $form['#submit'][] = 'webform_extra_submit';    
       }
}

// Adds a submit handler/function for the app signup form (Webform ID #1171) 

function webform_extra_submit($form, &amp;$form_state) 
{
     // Changes can be made to the Webform node settings by modifying this variable
    //$form['#node']-&gt;webform;

    // Insert values into other database table using same input IDs as external db
    $option['query'] = array(
        $firstName =&gt; $form_state['values']['firstName'],
        $lastName =&gt; $form_state['values']['lastName'],
        $email =&gt; $form_state['values']['email'],
        $name =&gt; $form_state['values']['name'],
        $phone =&gt; $form_state['values']['phone'],
    );
    $url = url('https://[url path to external site]', $option); 
    $form_state['redirect'] = $url;
   //$form['#action'] = url('https:[url path to external site]');
   //$url = 'https://[url path to external site]';
   //$headers = array('Content-Type' =&gt; 'application/x-www-form-urlencoded',);
   //$response = drupal_http_request($url, $headers, 'POST', http_build_query($form_state['values'], '', '&amp;'));
}
?&gt;
In Drupal forms, form_alter hooks can be used to change almost anything in the form. Additional submit handlers can be handled, validation can be done, elements can be added, etc. 

But for all of these to work, Drupal need to be the responsible party in both form build phase and the form submit phase. 

When you set $form['#action'] = url('https://[url path to external site]');, you are actually removing Drupal from that latter responsibility. 

Check the altered form - you will see that the form tag's action is set to the external site. 
When the form is submitted, browser sends all its data to that external site, and Drupal no longer can validate or perform submit functions in the form. I think this is the misconception happens. 

If you don't want Drupal to validate the form, record the webform submission or do anything after the form submission and let the remote site do everything for that submission, your code will work just fine. You can remove $form['#submit'][] = 'webform_extra_submit'; part and the webform_extra_submit function itself. 

However, if you do want to record the submission and submit the data to that remote site as well, you can do it like this:

function webform_extra_form_alter(&amp;$form, &amp;$form_state, $form_id)                 
{
   //only want form with nid 1171 to submit externally 
   //Note that "webform_client_form_1171" means modify the Webform form for the node with NID "1171". Adjust to match whichever webform node's form you're modifying
   if($form_id == 'webform_client_form_1171') 
       {
            $form['#submit'][] = 'webform_extra_submit';    
       }
}

// Adds a submit handler/function for the app signup form (Webform ID #1171) 

function webform_extra_submit($form, &amp;$form_state) {

    $options = array();
    // Array keys are matching the key that the remote site accepts. URL encoding will be taken care later.
    $options['data'] = array(
        'firstName' =&gt; $form_state['values']['firstName'],
        'lastName' =&gt; $form_state['values']['lastName'],
        'email' =&gt; $form_state['values']['email'],
        'name' =&gt; $form_state['values']['name'],
        'phone' =&gt; $form_state['values']['phone'],
    );
    $options['data'] = http_build_query($options['data']);
    $options['method'] =&gt; 'POST';
    $url = 'https://[url path to external site]'; 

    // Put your additional headers here. Cookie can be set as well. 
    $headers = array('Content-Type' =&gt; 'application/x-www-form-urlencoded');

    $options['headers'] =&gt; $headers;

    // Submits data to the remote server from the drupal server. User will remain in the Drupal form submission chain.
    $response = drupal_http_request($url, $options);

}