Form is not submitted with arg() in URL I have a list of items. By clicking on an item I open a form at /items_form/123 where 123 is the itemid. When filling the form I use the arg() function to get the 123 and read some data from the database. No problem.

My problem is, when submitting the form, the default submit handler is not called.
When I open the form without the arg e.g. /items_form and submit this form, the submit handler is called.
Where is my missing link?
Here is my hook_menu:

$items['items_form'] = array(
'title' =&gt; 'Item Form',
'page callback' =&gt; 'drupal_get_form',
'page arguments' =&gt; array('get_item_form'),
'access arguments' =&gt; array('access items_form content'),
'type' =&gt; MENU_NORMAL_ITEM, //Will appear in Navigation menu.
);


Any ideas?
First, if you want to get an argument from the URL, you should declare it in hook_menu, as such:

$items['items_form/%'] = array(
  'title' =&gt; 'Item Form',
  'page callback' =&gt; 'drupal_get_form',
  'page arguments' =&gt; array('get_item_form', 1),
  'access arguments' =&gt; array('access items_form content'),
  'type' =&gt; MENU_NORMAL_ITEM, //Will appear in Navigation menu.
);


Drupal's menu system will then pass in the itemid to drupal_get_form(), which will then pass it along to your form declaration function. You will need to add an argument to your function definition to access it, suggest something like this:

function get_item_form($form, $form_state, $itemid = NULL){
  $form = array();
    ...
}


Please look at the documentation for hook_menu for more information about how to handle URL arguments. I would caution against using arg() in your code.

The reason this is important is what happens when you submit your form with a URL argument. By default, if you do not override with the #action parameter in your form, it submits a POST request to the present URL. By not declaring that your URL has an argument in it, Drupal actually doesn't know how to handle a request to *items_form/123*. The only reason you see anything but a 404 when you go to *items_form/123* is that Drupal attempts to find the nearest path. I suspect that since it doesn't know explicitly what to do when a request is made to *items_form/123* it breaks the form submission handling. 

I should also mention that you'll need to declare both *items_form* and *items_form/%* menu paths if you wish them both to work. They're distinct paths in the eyes of Drupal's menu system.