Hi everyone, I write a custom submit form for my web page. I take input from user and send it to web service. In my test machine code works well. However it doesn't work in real machine. I enter address info but I don't get it before post. My code returns 404 error because textfield value is null but I almost enter address. I think it would be bug because the same code works in other machine.
$name = $form_state['values']['searchresult']; // I write to this to get textfield value.

Does anyone help me? My code is below.

function searchresult_form1($form, &$form_state) {

$form['searchresult'] = array(
'#type' => 'textfield',
'#title' => t(' Address '),
'#size' => 75,
'#maxlength' => 1000,
'#minlength' => 1,
'#required' => TRUE,
'#description' => t('Enter the addresses'),
);

$form['image_button'] = array(
'#type' => 'image_button',
'#value' => t('Search'),
'#src' => 'sites/butons/searchbutton.png',
);

return $form;
}

function searchresult_form_submit($form, &$form_state){
$form_state = $_SESSION['submitted_form'];

$header = array(t('Search Result'));

$name = $form_state['values']['searchresult'];

$url = "http://serviceIp/paht1/path2/$name";
$options = array(
'method' => 'GET',
'data' => NULL,
'timeout' => 15,
'headers' => array('Content-Type' => 'application/x-www-form-urlencoded')
);
$response = new stdClass();
$response = drupal_http_request($url, $options);
if ($response->code == 200) {
$result = $response->data;
return $result;
}else{
return theme('table') . t(' Alert for user');
}

}

Comments

laltor created an issue.