I am beginner to Drupal 7. I am trying to start with Basic Form handling. I created a directory my_module in sites/all/modules. Created my_module.info file using notepad with the following contents
name = My module
description = Module for form api tutorial
core = 7.x
Then I created my_module.module file with the following contents
<?php
/**
* This function defines the URL to the page created etc.
* See http://api.drupal.org/api/function/hook_menu/6
*/
function my_module_menu() {
$items = array();
$items['my_module/form'] = array(
'title' => 'My form',
'page callback' => 'my_module_form',
'access arguments' => array('access content'),
'description' => 'My form',
'type' => MENU_CALLBACK,
);
return $items;
}
function my_module_form() {
// This form calls the form builder function via the
// drupal_get_form() function which takes the name of this form builder
// function as an argument. It returns the results to display the form.
return drupal_get_form('my_module_my_form');
}
/**
* This function is called the "form builder". It builds the form.
* Notice, it takes one argument, the $form_state
*/
function my_module_my_form($form_state) {
// This is the first form element. It's a textfield with a label, "Name"
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
);
return $form;
}
But when I goes to module list and tries to enable the newly created module it is not being listed. Kindly help me to resolve this problem. I have gone through several techniques shown in different forums like deleting multiple copies of the files,providing permissions etc.But all in vain.
my_module
directory undersites/all/modules
.