Multiple buttons to link to different page and different query I have a page in my site (from a custom module) with a hook_menu (red boxes).



The code for the menu is as follows:

$items['upcoming_games/' . date('Y-m-d')] = array(
  'menu_name' =&gt; 'main-menu',
  'title' =&gt; 'Upcoming Games',
  'page callback' =&gt; 'my_page',
  'access callback' =&gt; TRUE
);


The page callback calls a function where I insert the date as an argument for a query.
When clicking the menu, it defaults to TODAY.

What I need is to query for a different date depending on the click of the coloured buttons. I get "page not found"...

In the function where I have my query I get the date with the follwing code:

$date_to_show = arg(1);


What am I missing here?
Use the following code:

function sample_menu() {
  // This is a default option, without argument.
  $items['upcoming_games'] = array(
    'title' =&gt; 'Upcoming Games',
    'page callback' =&gt; 'my_page',
    'page arguments' =&gt; array(),
    'access callback' =&gt; TRUE,
  );
  // This is for any other date.
  $items['upcoming_games/%'] = array(
    'title' =&gt; 'Upcoming Games',
    'page callback' =&gt; 'my_page',
    'page arguments' =&gt; array(1),
    'access callback' =&gt; TRUE,
  );

  return $items;
}

function my_page($date = NULL) {
  // If the $date has not been defined, it means that the user is trying to see
  // today's games.
  if (!$date) {
    // Redirect to today's date.
    drupal_goto('upcoming_games/' . format_date(REQUEST_TIME, 'custom', 'Y-m-d'));
  }
  // Otherwise, check the date. The strtotime() function is just as an example.
  else {
    $date = strtotime($date);
  }
  // Continue the operation.
  // ...
  return 'Upcoming games for ' . format_date($date, 'custom', 'Y-m-d');
}