I'm creating a 'search' module that plugs into an external system and displaying the results in the standard drupal framework, which is all working when I use a static test query.

However I want to pass a query into it from a form, and I'm having trouble passing that in.

I can pass in:

http://www.mysite.com/dbsearch/queryterm

but I want to pass in:

http://www.mysite.com/dbsearch?query=queryterm

Because it's a form submission and that's the way a GET form will create the search URL, and I don't want to have to use javascript to do this as no javascript means no search.

Comments

nevets’s picture

Even with clean URLs on Drupal is using a path like http://www.mysite.com?q=dbsearch, the query=queryterm looks like a second query parameter. If you change

http://www.mysite.com/dbsearch?query=queryterm

by replacng the ? with a & like this

http://www.mysite.com/dbsearch&query=queryterm

it should work

colm_iqc’s picture

That won't work, there's parsing and string checking in drupal core, it will accept the ? character and assume it's a new parameter, but in my module how to I give a wildcard/parameter as a path. when I ammend the ? or even the & I get a 404.

nevets’s picture

If you use either the url() or l() function they both support building a url with a query. The other half of the question is how are you defining the callback path in the menu hook?