GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Tuesday, February 15, 2011

Simple Drupal Drupal Form

<?php
/**
  * Implements hook_menu()
  */
function data_menu(){
    $items = array();

    $items['learning/data'] = array(
        'title' => 'Hello Data',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('hello'),
        'access callback' => TRUE,
       
    );   
   
    return $items;
}

function hello($form, &$form_state){
    $form = array();
    $form['username'] = array(
        '#type' => 'textfield',
        '#title' => t('Username'),
        '#size' => 30,
    );
    $form['password'] = array(
        '#type' => 'password',
        '#title' => 'Password',
    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => 'Send',
    );
    return $form;
}


Share/Bookmark

No comments:

Post a Comment