- function transport_services_perm() // used for setting permission
- {
- return array('access content transport_services');
- }
- function transport_services_menu() // creating menu
- {
- $items['transport_services'] = array(
- 'page callback' => 'transport_services_page',
- 'access arguments' => array('access content transport_services'),
- 'access callback' =>'user_access',
- ); return $items;
- }
- function transport_services_page()
- {
- $output='Welcome to R';
- $output .= drupal_get_form('transport_services_form1');
- return $output;
- }
- // Actual form being defined here....
- function transport_services_form2($form_id, $form_state = NULL)
- {
- $form['reg_no'] = array(
- '#title' => t('Registration Number:'),
- '#type' => 'textfield',
- '#size' => '25',
- '#required' => TRUE,
- '#prefix' => '',
- '#suffix' => '',
- );
- $form['reg_name'] = array(
- '#title' => t('Registration Name:'),
- '#type' => 'textfield',
- '#size' => '25',
- '#required' => TRUE,
- '#prefix' => '',
- '#suffix' => '',
- );
- $form['submit'] = array(
- '#type' => 'button',
- '#value' => t('Submit'),
- '#validate' => array('transport_services_renewal_output')
- );
- return $form;
- }
- // Submit Function is defined....
- function reusable_services_form1_submit($form_id,$form_state)
- {
- $reg_no = $form_state['values']['reg_no'];
- $reg_name = $form_state['values']['reg_name'];
- db_query("INSERT INTO {registration} (registration_no) VALUES('%d','%s')",$reg_no,$reg_name);
- drupal_set_message(t(“No==>”.$reg_no));
- drupal_set_message(t(“Name==>”.$reg_name));
- drupal_set_message(t(“Successfully inserted values”));
- }
This site will provide lot of information for all the internet users with details of shortcut techniques and many more........
Showing posts with label drupal form. Show all posts
Showing posts with label drupal form. Show all posts
Saturday, January 29, 2011
Simple Form in Drupal
Subscribe to:
Posts (Atom)