How to send data like NAME[]=value via POST request and simultaneously redirect user to 3rd party server? I'm writing a custom module which needs to send data string like this: "CODES[]=xxx&amp;NAMES[]=xxx" via POST to 3rdparty payment gateway AND redirect user there.

I've written a form to gather data from customer, but I can't use [] in form fields names, Drupal reports an error (an array instead of string) and quits.

I can post all data manually via drupal_http_request, but it doesn't redirects browser to needed URL. If I use drupal_goto after drupal_http_request, the data is lost and payment service doesn't recognize the user. If I include $request(my drupal_http_request)->result in a page, I get redirected to 404 page of my site with a non-existent URL (/order/checkout.php which has to be appended to payment server root and instead glues to my server root URL).

If I use $form['#redirect'] or $form['#action'] it posts fields names without "[]".

Question is, how can I append these square brackets after request is formed, but before it is sent? 

Or how can I send data along with redirecting?

Will be very grateful for help, this problem is driving me nuts for a week now.

UPD My code:

    //a form
function mymodule_ask(&amp;$form_state) {

 $form = array();

$form['#action'] = 'https://3rdpartysite.url/script.php';
$form['#method'] = 'post';

 $form['ORDER_PRICE[]'] = array(
   '#type' =&gt; 'textfield',
   '#title' =&gt; t('Amount'),
   '#size' =&gt; 10,
   '#required' =&gt; TRUE
 );

 $form['ORDER_PNAME[]'] = array (
   '#type' =&gt; 'radios',
   '#title' =&gt; t('Name'),
   '#options' =&gt; array('Avia' =&gt; 'Avia tickets', 'Other' =&gt; 'Other'),
   '#required' =&gt; TRUE
 );

 $form['submit'] = array (
   '#type' =&gt; 'submit',
   '#value' =&gt; t('PAY')
 );

return $form;
}

function mymodule_ask_submit {
    //in form submit function retrieving data from form values
    $requestar['ORDER_PNAME[]'] = $form_state['values']['ORDER_PNAME'];
    $requestar['ORDER_PRICE[]'] = $form_state['values']['ORDER_PRICE'] * 1.02;
    //forming an array to post
    $onestr = '';
    foreach ($requestar as $key =&gt; $value) {
    $onestr .= $key."=".$value."&amp;";
    }
    $resstr = chop($onestr, '&amp;');
    // and then I tried different ways

    //either creating and auto-submitting a form with needed values
    create_form($requestar); //separate function creating this form
    drupal_execute('payu_addform', $form_state);
    // but it doesn't pass drupal evaluation because of "ORDER_PRICE[]" element name

     //or via http_request
    $result = drupal_http_request('https://PAYMENT_SERVER_URL/script.php',  array('Content-Type' =&gt; 'application/x-www-form-urlencoded'), 'POST', $resstr);
    drupal_set_message($result-&gt;request);

    // but it takes me to MY_SERVER_URL/order/checkout.php?CART_ID=442bc42170616cd36dfd2246434d4210, while I need it to make to PAYMENT_SERVER_URL/order/checkout.php?bla-bla-bla
    //may be I can use $result-&gt;request in some other way? Just printing within this submit function gives nothing... But how can I pass it to make drupal take me out?

}
Try setting the name directly:

$form['order_price'] = array(
  '#type' =&gt; 'textfield',
  '#title' =&gt; t('Amount'),
  '#size' =&gt; 10,
  '#required' =&gt; TRUE,
  '#name' =&gt; 'ORDER_PRICE[]',
);