Hi

I know this is really basic, but how do I parse and pass a URL's query string to the appropriate module?

Sending me a tutorial link or two would be GREAT!

My URL with query string maybe as simple as Sorting a column upon a table:
.../index.php?q=admin/reports/storage/tables&sort=desc&order=Name

Or requesting to Perform an action requested by a link:
.../index.php?q=admin/reports/storage/tables&action=delete&id=15

Thanks

Comments

duckzland’s picture

You can use php $_POST or $_GET to get the url

or you can try use drupal arg() example http://drupal.org/this-is-argument-0/this-is-argument1

   print arg(0); // result = this-is-argument-0
   print arg(1); // result = this-is-argument1

// to parse the url you can utilize drupal l() api

  l('link this to arg(0)', 'this-is-argument-0');

  l('link this to arg(1)', 'this-is-argument-0/this-is-argument1');

--------------------------------------------------------------------------------------------------------
if you can use drupal why use others?
VicTheme.com

jeff00seattle’s picture

Thanks for the reply.

I knew I could do it with $_REQUEST, but I thought maybe there might have been a native Drupal function that parses query strings.

goofus’s picture

Hi.
Drupal calls it's request dispatcher "Menu". http://api.drupal.org/api/group/menu
....
Hook_menu allows you to define a request url and dispatch requests to you code.

mooffie’s picture

What goofus means is that in Drupal it's customary to use paths instead of query parameters. Deleting could be carried out by "admin/reports/storage/tables/15/delete". (As for sorting, the pager already handles this for you.)