How to create a URL with $_GET values by writing my own custom module? I am writing my own module and I would like to know how to create a URL from a search form that utilizes $_GET requests so I can pass those arguments into my query. 

The Views module is a good example.  For example, after you create a view and have exposed filters, your Views URL would look like:

CustomView?field_data_field_year=2012&amp;field_data_field_month=december


Currently my hook_menu looks like:

function papers_pub_search_menu() {
  $items['papers_pub_search'] = array(
      'title' =&gt; 'Papers and Publications Search',
      'description' =&gt; 'Search Papers and Publications',
      'page callback' =&gt; 'papers_pub_search_viewer',
      'page arguments' =&gt; array(1,2),
      'access arguments' =&gt; array('access papers and pub search'),
      'type' =&gt; MENU_CALLBACK,
  );
  return $items;  
}    


My problem is the 'page arguments' => array(1,2).  It seems like the format of the URL would be "foo/bar" and it would strictly need 2 arguments.  My user may pass 1 or 3 arguments based on what parts of my form fields they fill out.

Another simple example, if I wanted to do this in pure PHP, it would be trivial:

&lt;?php
if($_GET['submit']) {
  $name = $_GET['name'];
  $query = "SELECT name FROM user WHERE name = $name";
  ...
}
?&gt;
&lt;form action="form.php" method="get"&gt;
  &lt;input type="text" name="name"&gt;
  &lt;br&gt;
  &lt;input type="submit" name="submit" value="submit"&gt;
&lt;/form&gt;


What I am trying to do is create a form where a user can fill out some fields, and then do some DB query based on what the user has inputted into various text fields and pull down choices once they hit submit.
If I understood your question correctly, you are mixing the URL arguments and query string.

You can have as many query string arguments as you want and you do not have to define them upfront. Drupal will not limit you. An example of query string is page?arg1=123&amp;arg2=456, just like what views module does for filters. This is what you need for your $_GET form.

What you define in the hook_menu are URL arguments - for example one/two/three. You can get them by using the arg() function, so arg(0) in the example above would return one, arg(1) would return two etc.



UPDATE


  So is the URL arguments in hook_menu not needed (i.e. page arguments)?


Yes, you don't need it in this case. You will solve everything by using query string (~question mark in the URL).


  Does 'page?arg1=123&amp;arg2=456' not count as an argument, or is that just one big argument (i.e. arg(0))?


That is only one argument. arg(0) would return just page. arg1 and arg2 are query string parameters.

Think of page argument as a part of the base URL for the page.
Query string is what goes after the question mark.

You should use filter_input() instead of simple $_GET as it is much more secure.

See also drupal_get_query_parameters().