0

I need to use drupal_goto, but I need to pass some parameters using POST method.

Actually I use this code:

$url="someURL";

$params= array('query'=>array(
'n'=> $data,
'VerPedido'=>'back'
));
drupal_goto($url,$params); 

This code redirect and pass params adding to URL, sample

http://XXXX/someURL?n=1&VerPedido=back

I need to pass this information using POST method, because I need to obtain this params at destination URL

I have readed this post but for do that I need to add html code at form_submit

I tried to add this:

$output="
<form action='someURL' method='post' name='frm'>
<input type='hidden' name='n' value='".$data."'>
<input type='hidden' name='VerPedido' value='back'>


</form>
<script language=\"JavaScript\">
document.frm.submit();
</script>";

return $output;

But beacause this code it's at mymodule_form_submit($form_id, $form_values) doesn't works

Community
  • 1
  • 1
Daniel
  • 2,371
  • 3
  • 15
  • 14
  • Why do you need to `POST` data when you can store the data locally in the user session? – Rawkode Dec 19 '12 at 15:42
  • 3
    Not possible I'm afraid, `drupal_goto()` wraps around [`url()`](http://api.drupal.org/api/drupal/includes%21common.inc/function/url/7) which provides no such mechanism. See [this post](http://stackoverflow.com/questions/5576619/php-redirect-with-post-data) for an explanation of why it's not possible in general – Clive Dec 19 '12 at 15:46
  • Hi, thanks, I will read that code – Daniel Dec 19 '12 at 17:44

1 Answers1

0

If you want to use drupal_goto itself then its not possible but using PHP header function you can. See here

Community
  • 1
  • 1
mantish
  • 400
  • 3
  • 12