I have simple Drupal form, that should colect user imput and return "electricity consumption quote". I created a module and put form in it. (so far so good)
Now I need to cal this form from a block that appears on all pages and pass it couple of arguments, amount and supply number (electricity supplier). I need these two values to populate first two fields in the form. Can I pass this two arguments via url (or some other way). Bellow is example code
/**
* Implementation of hook_menu().
*/
function getquote_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'getquote',
'title' => t('Instant quotes'),
'callback' => 'getquote_page',
'access' => TRUE
);
}
return $items;
}
/**
* Called when user goes to example.com/?q=getquote
*/
function getquote_page($quote) {
$output = t('Get an instant quote on-line.');
// Return the HTML generated from the $form data structure.
$output .= drupal_get_form('getquote_nameform');
return $output;
}
/**
* Defines a form.
*/
function getquote_nameform() {
// *********** basic options ************************************
$form['basicinfo'] = array(
'#title' => t('Basic information'),
'#type' => 'fieldset',
'#description' => t('Get a quick quote based on some basic information')
);