I am very new to drupal and working with D7
I have created two form with a custom module. mysite.com/custom is showing both the forms at the same time
I want each of the form to be shown with 2 different URLs. eg mysite.com/custom1 eg mysite.com/custom2
How is it possible.OR is it not possible at all. am i totally wrong in understanding how the module and forms work?
code
function custom_menu() {
$items['custom'] = array(
'title' => t('Custom'),
//'page callback' => 'drupal_get_form',
'page callback' => 'custom_page_callback',
//'page arguments' => array('custom_form'),
//'access arguments' => array('custom module'),
'access callback' => TRUE,
);
return $items;
}
function custom_page_callback() {
$build = array();
// Render your two forms here.
$build['form_one'] = drupal_get_form('custom_form');
$build['form_two'] = drupal_get_form('custom_second_form');
return $build;
}
/**
* Our custom form.
*/
function custom_form($form, &$form_submit) {
$form['title'] = array(
'#title' => t('Give a title'),
'#type' => 'textfield',
'#required' => TRUE,
);
$form['name'] = array(
'#name' => t('Give a Name'),
'#type' => 'textfield',
'#required' => FALSE,
'#maxlength' => 25,
'#size' => 10,
);
$form['submit'] = array(
'#value' => 'Add',
'#type' => 'submit',
);
return $form;
}
/**
* Our custom form second.
*/
function custom_second_form($form, &$form_submit) {
$form['title'] = array(
'#title' => t('Give a title'),
'#type' => 'textfield',
'#required' => TRUE,
);
$form['submit'] = array(
'#value' => 'Add',
'#type' => 'submit',
);
return $form;
}
Thanks all