create module that load index.php
The Drupal way

In Drupal we create similar form like this:

Create a custom module


Create a file sites/all/modules/own/form_test/form_test.info with this in it:

name = form_test
description = form_test
core = 7.x
package = Own
Create a file sites/all/modules/own/form_test/form_test.module


(start it with &lt;?php tag, but don't add ending ?> tag)

Write these functions in your module:

function form_test_menu() {
  $items['formtest'] = array(
    'title' =&gt; 'Form Test',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('form_test_form'),
    'access callback' =&gt; TRUE,
    );
  return $items;
}


An explanation

form_test_menu 
creates a menu item in your navigation menu so we can have a place where to show our custom form. You can think that menu address referring to a page yoursite/formtest.

title   

Title of the page.

page callback   

Calls a function drupal_get_form which returns a render array for drupal_render().

page arguments  

Here we pass our custom render array (which form_test_form returns) as an argument for drupal_get_form.

access callback  

We define it TRUE so that everyone can access this page.

(Rendering means turning a structured array into HTML.)

function form_test_form($form,&amp;$form_submit) {
  $form['firstname'] = array(
    '#title' =&gt; t('Firstname'),
    '#type' =&gt; 'textfield',
    '#required' =&gt; TRUE,
  );
  $form['lastname'] = array(
    '#title' =&gt; t('Lastname'),
    '#type' =&gt; 'textfield',
  );
  $form['submit'] = array(
    '#value' =&gt; 'Submit',
    '#type' =&gt; 'submit',
    );
  return $form;
}


An explanation

So we use render arrays to describe a form in drupal.

When you use a function to return a render array for drupal_get_form, there are two default parameters that are in use:

$form   Holds the form array items we define inside the function when this function is called again.

&amp;$form_submit   This parameter holds various data items like the values you pass when you submit the form.

(Ampersand &amp; means that this is a reference to a variable, so if we change this variable in this function, changes will show in the parent function too.)

Form items are added as arrays to the $form variable. Hash (#) sign refers to an attribute of the item.

Enable the module in admin/modules

Flush the caches

Form can be seen in yoursite/formtest, but it doesn't do anything yet.

OR
more links are :

Drupal 7 - How to Make a Simple Module with a Form and Menu Link

Ten Step-by-Step Code Samples for Learning Form API