All pastes #282531 Raw Edit

Untitled

public php v1 · immutable
#282531 ·published 2006-12-17 17:50 UTC
rendered paste body
<?php/** * Implementation of hook_help(). */function myform_help($section) {  switch ($section) {    case 'admin/modules#description':      return t('blah myform');  }}/** * Implementation of hook_menu(). */function myform_menu($may_cache) {  $items = array();  if ($may_cache) {    $items[] = array('path' => 'myform', 'title' => t('myform'), 	'access' => user_access('access content'),	'callback' => 'myform_callback',	'type' => MENU_CALLBACK);    $items[] = array('path' => 'myform_results', 'title' => t('myform/results'), 	'access' => user_access('access content'),	'callback' => 'myform_results',	'type' => MENU_CALLBACK);  }   return $items;}function myform_callback() {$form['inputs'] = array('#type' => 'fieldset','#title' => 'inputs','#tree' => TRUE,'#id' => 'testname',);$form['inputs']['name'] = array('#type' => 'textfield','#title' => t('name'),'#default_value' => variable_get('name', ''),);$form['inputs']['submit'] = array('#type' => 'submit','#value' => t('submit'),);$output = drupal_get_form('myform_callback', $form);return $output;}function myform_callback_submit($form_id, $form_values) {$name = $form_values['inputs']['name'];variable_set('mymodule_name', $name);//$msg = 'your name is ' . $name;foreach ($_POST as $key => $value) {$msg .= print_r($value, true);}return 'myform/results';}function myform_results() {$name = variable_get('mymodule_name', 'default value if no variable set');drupal_set_message($name);drupal_set_message('hhhh');}