Closed (works as designed)
Project:
Drupal core
Version:
4.7.0-rc3
Component:
forms system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Apr 2006 at 13:39 UTC
Updated:
20 Apr 2006 at 06:32 UTC
The following module works, but changing 'get' with 'post' and $_GET with $_POST not
(PHP Version 4.3.11)
function example_form($example = '') {
$form['fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Example module'));
$form['fieldset']['item'] = array(
'#type' => 'item',
'#title' => '',
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
);
$form['fieldset']['item']['example'] = array(
'#type' => 'textfield',
'#title' => t('example'),
'#default_value' => $example,
'#size' => 20,
'#maxlength' => 1024
);
$form['fieldset']['item']['submit'] = array(
'#type' => 'submit',
'#value' => t('Verify')
);
$form['#method'] = 'get';
$form['#action'] = url('example');
return drupal_get_form('example_form', $form);
}
function _example_all() {
$example = isset($_GET['edit']['example'])? trim($_GET['edit']['example']): '';
$output = example_form($example) . '<br /> example:' . $example;
return $output;
}
function example_help($section = '') {
$output = '';
switch ($section) {
case 'admin/modules#description':
$output = t('Example module.');
break;
}
return $output;
}
function example_perm() {
return array('execute example module');
}
function example_menu($may_cache) {
$items = array();
if($may_cache)
{
$items[] = array('path' => 'example',
'title' => t('example module'),
'callback' => '_example_all',
'access' => user_access('execute example module'));
}
return $items;
}
Comments
Comment #1
moshe weitzman commentedthe form api is designed so you do not need to reference those superglobals. what are you tring to do. plese reopen with more detail.
Comment #2
he_who_shall_not_be_named commentedThanks a lot. The following example is a bit unusual but it works.
Thank you again.