Creating a form using a path argument I'm writing a simple module to handle newsletter subscriptions and I want to create a form which is based on information passed in as a url argument. 

Example path: /subscribe/verify/eiurhgiergierugskdfadsf

I'd like to create a form for /subscribe/verify which takes "eiurhgiergierugskdfadsf" as a parameter so that I can lookup the user by that hash value and then populate the form with their subscriber id and other information.

I can't seem to figure out how to get url arguments available in my form function though. 

$items['subscribe/verify'] = array(
    'title' =&gt; 'Verify Email',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('subscribe_terms_form_verify'),
    'access arguments' =&gt; array('access content'),
);



function subscribe_terms_form_verify($unique_id) {
   ...
}


How do I safely get access to the url parameter in my form callback?
You need to introduce the argument as a 'wildcard', and pass it through to your function in the page arguments like so:

$items['subscribe/verify/%'] = array(
  'title' =&gt; 'Verify Email',
  'page callback' =&gt; 'drupal_get_form',
  'page arguments' =&gt; array('subscribe_terms_form_verify', 2),
  'access arguments' =&gt; array('access content'),
);


The hook_menu() docs are worth read, they explain wildcards in good detail.

Your form function will have this signature:

function subscribe_terms_form_verify($form, &amp;$form_state, $unique_id) {

}


$form and $form_state are provided as parameters to your form through drupal_get_form(), so the 3rd argument will contain the information passed from the URL.