<?php
function my_module_menu() {
$items['my_module/form'] =
array(
'page callback' => 'my_module_form',
'access arguments' =>
array('access content'),
'description' =>
t('My form'),
);
return $items;
}
// This function gets called when we visit 'my_module/form' page. It will generate
// a page with our form on it.
function my_module_form() {
// We build the form by calling the form builder function via the
// drupal_get_form() function which takes the name of our form builder
// function as an argument. We return the results to display the form.
}
// This function is what we call the "form builder". It builds the form.
// Notice it takes one argument, the $form_state
function my_module_my_form($form_state) {
// Here is our first form element. It's a textfield with a label, "Name"
'#type' => 'textfield',
);
return $form;
}