GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Tuesday, February 15, 2011

ComboBox In Drupal Form

<?php

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['hello'] = array(
        '#type' => 'fieldset',
        '#title' => 'Please fill the form below',
    );
    
    $form['hello']['years'] = array(
        '#type' => 'select',
        '#title' => 'Where you do live right now?',
        '#options' => array(
            1 => t('Indonesia'),
            2 => t('Malaysia'),
            3 => t('Filipine'),        
        ),
    );

    $form['hello']['submit'] = array(
        '#type' => 'submit',
        '#value' => 'Login',
    );
    return $form;
}

Share/Bookmark

No comments:

Post a Comment