Observer the use of ‘%’ sign, It is used as placeholder for your argument.
Here we are passing argument by URL at 1st and 3rd position. URL may be like this “order/102/qty/2”.

/**
* Implementation of hook_menu
*
*/
function mymodule_menu() {
$items = array();
$items[‘order/%/qty/%’] = array(
‘title’ => t(‘My Module Title’),
‘page callback’ => ‘mymodule_create_order’,
‘page arguments’ => array(1,3),
‘access arguments’ => array(‘administer create order’),
‘type’ => MENU_CALLBACK,
);
return $items;
}

/**
* custom function
*
*/
function mymodule_create_order($order,$qty){
//Check this variables
echo $order; //Show 102
echo $qty; //Show 2
return TRUE;
}

Advertisements