I'm currently working on a custom search function for a module I'm building. The problem I'm having is that I need to pass the $_POST[edit] information to the command line and I can't figure out how. The reason I need to do this is as follows:
Here is my logic.
Search form takes text field and checkmarks (author, title, contents). When submit is called it goes to the URL "/mymodule/search." When that URL is accessed it grabs the $_POST[edit] array and passes it to a search function which then queries the database and spits out results.... until I want to go to page 2.
Since my search functions are entirely internal when I click on page 2 of the pager I am told that there are no results. This is happening because the search function is being run, but no POSTDATA exists anymore.
So what I need is to figure out a way to get the post data into the URL right away.
here is the search form I have right now:
function mymodule_search_form {
$form = form_textfield(t('Search String'), 'search_string', NULL, 70, 255);
$form .= form_checkboxes(t('Search Options'), 'search_options', NULL, array(t('Author'), t('Title'), t('Contents'))). form_submit(t('Submit'));;
$output = form($form, 'post', url('mymodule/search/'));
return $output;Is there a way for me to get the results from the text field and checkboxes into the $output? I'd prefer for the url in the output to be like this: url('mymodule/search/012/search_string'). (FYI, "012" is just a representation of the checkbox array. I can take care of converting it to a text string myself, so don't worry about explaining that one).
Anyway, I hope this made sense as I'm desperatly trying to get this done. I'm not too comfortable on having hundreds of search results on the same page, so I'd like to figure this out.
mateo
Comments
found something that works
I found if I use the header function I can redirect the function unto itself. Bsaically when the url of "mymodule/search" is entered, it redirects itself to "mymodule/search/012/search_string"
The code I used to do this is:
the function article_dosearch then searches the table snad spits out the desired results. I'm sure the codeisn't entirely efficient, so if anyone can help I'd appreciate it very much.
The entire module can be seen here: http://72.9.242.6/article
Mateo