When calling drupal_goto I can't seem to successfully pass a querystring along with the url.
When calling drupal_goto I can't seem to successfully pass a querystring along with the url. below is my call to drupal_goto: * $query = array(); $query['status'] = 'bye'; drupal_goto('admin/store/free_subscription',$query);* Within the called page I output the contents of the $_GET variable using: *dd($_GET);* Below is contents of $_GET: *Array ( [q] => admin/store/free_subscription )* Note: it has the *q *parameter but no *status *parameter. Any ideas on what I am doing wrong? Thanks, John
You didn't specify which version of Drupal you are using, but assuming Drupal 6 - drupal_goto expects $query to be a string, not an array. So: drupal_goto('admin/store/free_subscription', 'status=bye'); William On Thu, Mar 10, 2011 at 12:46 PM, John Mitchell <mitchelljj98@gmail.com>wrote:
When calling drupal_goto I can't seem to successfully pass a querystring along with the url.
below is my call to drupal_goto: * $query = array(); $query['status'] = 'bye'; drupal_goto('admin/store/free_subscription',$query);*
Within the called page I output the contents of the $_GET variable using: *dd($_GET);*
Below is contents of $_GET: *Array ( [q] => admin/store/free_subscription )*
Note: it has the *q *parameter but no *status *parameter.
Any ideas on what I am doing wrong?
Thanks,
John
Drupal Version 6. I tried drupal_goto('admin/store/free_subscription', 'status=bye'); and it still did not work. Below is contents of $_GET: *Array ( [q] => admin/store/free_subscription )* John On Thu, Mar 10, 2011 at 12:54 PM, William Smith <william.darren@gmail.com>wrote:
You didn't specify which version of Drupal you are using, but assuming Drupal 6 - drupal_goto expects $query to be a string, not an array.
So: drupal_goto('admin/store/free_subscription', 'status=bye');
William
On Thu, Mar 10, 2011 at 12:46 PM, John Mitchell <mitchelljj98@gmail.com>wrote:
When calling drupal_goto I can't seem to successfully pass a querystring along with the url.
below is my call to drupal_goto: * $query = array(); $query['status'] = 'bye'; drupal_goto('admin/store/free_subscription',$query);*
Within the called page I output the contents of the $_GET variable using: *dd($_GET);*
Below is contents of $_GET: *Array ( [q] => admin/store/free_subscription )*
Note: it has the *q *parameter but no *status *parameter.
Any ideas on what I am doing wrong?
Thanks,
John
-- John J. Mitchell
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 The code goes: function drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response_code = 302) { $destination = FALSE; if (isset($_REQUEST['destination'])) { $destination = $_REQUEST['destination']; } If you have anything in $_REQUEST, it will go there first. G - drupal_goto considered harmful :D On 03/10/2011 10:02 AM, John Mitchell wrote:
I tried drupal_goto('admin/store/free_subscription', 'status=bye');
and it still did not work.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBCAAGBQJNeRKkAAoJEIudqlYAGRshlyUP/3o37T7cV9GxwuRJmm3zAZK0 BbDvdwpMU2csdH6rsenPULgkKqijuWJU62r7g7M+HFXW6bK7l4YIO7xs/RYQuOwo yZMCMtJmvnwExZNG18yNRPUTfu/xiRmMaIjR7pzk60gqKrjx08cLFO35Da8YiW7S nFPk9Hsxs/AuRajddubDkjh8W971o8JPEpTwA609H71aNEHkVRQjB42D/u8vH+nm 9P7c5gx7KfDq/ZI3x2aPK7g/JkslZzVXsyaaNBd3somlc1d+QTkpekTZ/NdWF8oq 6jMdn42A5IKUkDSeAiyt2TkZm+9lnW4IT2y04w5LhYX41qqm2GMjJQxX5HiKGTI7 DaRdwcPCgclo313Apd3sbiD2tLH0RdBm0wLdPSi1X2q58fY6wCqVml6y7JP0Pu2G 1ItpG3Uj8s4CN1Ut9om6snYU4OeuLFVbENWEI7a0Ao7gVzSE8SaFhsa1h0z7WPzB YdbMLH/6e9ozCxCjrBfgMG919Aze3gLWQ6XXjXwduHbRQwAfuBsZ48eh0hbvlF4X ojxyxDaaVQ4+cE9O4dRWnZW1nyolEaGBI8klpGo2oyXx5vbL3Wr5vyaVwUBgkM3s /rm7iIefyNtH01rKcHxe2ASjTCRLghe/KRtCt84fVin8t+KzPKvYdPCYxQFrnVLV SFWYUXEo/JPU44rtXWlP =VysZ -----END PGP SIGNATURE-----
Just want to correct myself - $query can actually be a string or an array in D6, it seems. On Thu, Mar 10, 2011 at 12:54 PM, William Smith <william.darren@gmail.com>wrote:
You didn't specify which version of Drupal you are using, but assuming Drupal 6 - drupal_goto expects $query to be a string, not an array.
So: drupal_goto('admin/store/free_subscription', 'status=bye');
William
On Thu, Mar 10, 2011 at 12:46 PM, John Mitchell <mitchelljj98@gmail.com>wrote:
When calling drupal_goto I can't seem to successfully pass a querystring along with the url.
below is my call to drupal_goto: * $query = array(); $query['status'] = 'bye'; drupal_goto('admin/store/free_subscription',$query);*
Within the called page I output the contents of the $_GET variable using: *dd($_GET);*
Below is contents of $_GET: *Array ( [q] => admin/store/free_subscription )*
Note: it has the *q *parameter but no *status *parameter.
Any ideas on what I am doing wrong?
Thanks,
John
Actually, not true. Arrays work too. According to the api docs. Hm... Are you really sure that you are editing the right call? Try changing the url to non existant one and just inspecting the browser url to verify that there isn't something else stripping off the url. Sent from my iPad On Mar 10, 2011, at 9:54 AM, William Smith <william.darren@gmail.com> wrote:
You didn't specify which version of Drupal you are using, but assuming Drupal 6 - drupal_goto expects $query to be a string, not an array.
So: drupal_goto('admin/store/free_subscription', 'status=bye');
William
On Thu, Mar 10, 2011 at 12:46 PM, John Mitchell <mitchelljj98@gmail.com> wrote: When calling drupal_goto I can't seem to successfully pass a querystring along with the url.
below is my call to drupal_goto: $query = array(); $query['status'] = 'bye'; drupal_goto('admin/store/free_subscription',$query);
Within the called page I output the contents of the $_GET variable using: dd($_GET);
Below is contents of $_GET: Array ( [q] => admin/store/free_subscription )
Note: it has the q parameter but no status parameter.
Any ideas on what I am doing wrong?
Thanks,
John
thanks for the suggestion of changing to a non existent url I realized that I needed to click the submit button. It works fine. Thanks, John On Thu, Mar 10, 2011 at 1:17 PM, Dave Metzler <metzler.dl@gmail.com> wrote:
Actually, not true. Arrays work too. According to the api docs.
Hm... Are you really sure that you are editing the right call? Try changing the url to non existant one and just inspecting the browser url to verify that there isn't something else stripping off the url.
Sent from my iPad
On Mar 10, 2011, at 9:54 AM, William Smith <william.darren@gmail.com> wrote:
You didn't specify which version of Drupal you are using, but assuming Drupal 6 - drupal_goto expects $query to be a string, not an array.
So: drupal_goto('admin/store/free_subscription', 'status=bye');
William
On Thu, Mar 10, 2011 at 12:46 PM, John Mitchell < <mitchelljj98@gmail.com> mitchelljj98@gmail.com> wrote:
When calling drupal_goto I can't seem to successfully pass a querystring along with the url.
below is my call to drupal_goto: * $query = array(); $query['status'] = 'bye'; drupal_goto('admin/store/free_subscription',$query);*
Within the called page I output the contents of the $_GET variable using: *dd($_GET);*
Below is contents of $_GET: *Array ( [q] => admin/store/free_subscription )*
Note: it has the *q *parameter but no *status *parameter.
Any ideas on what I am doing wrong?
Thanks,
John
-- John J. Mitchell
Drupal 6 or 7? Sent from my iPad On Mar 10, 2011, at 9:46 AM, John Mitchell <mitchelljj98@gmail.com> wrote:
When calling drupal_goto I can't seem to successfully pass a querystring along with the url.
below is my call to drupal_goto: $query = array(); $query['status'] = 'bye'; drupal_goto('admin/store/free_subscription',$query);
Within the called page I output the contents of the $_GET variable using: dd($_GET);
Below is contents of $_GET: Array ( [q] => admin/store/free_subscription )
Note: it has the q parameter but no status parameter.
Any ideas on what I am doing wrong?
Thanks,
John
The version of Drupal you use matters. You don't say, so I'll show both. I Drupal 7: drupal_goto('admin/store/free_subscription', array('query' => array('status' => 'bye'))); In Drupal 6: drupal_goto('admin/store/free_subscription', array('status' => 'bye')); See http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_goto/6 On 3/10/2011 9:46 AM, John Mitchell wrote:
When calling drupal_goto I can't seem to successfully pass a querystring along with the url.
below is my call to drupal_goto: / $query = array(); $query['status'] = 'bye'; drupal_goto('admin/store/free_subscription',$query);/
Within the called page I output the contents of the $_GET variable using: /dd($_GET);/
Below is contents of $_GET: /Array ( [q] => admin/store/free_subscription )/
Note: it has the /q /parameter but no /status /parameter.
Any ideas on what I am doing wrong?
Thanks,
John
participants (5)
-
Dave Metzler -
Earl Miles -
Guillaume -
John Mitchell -
William Smith