I would like to validate the company name chosen of the submitted from a select option - "Company"
When I try $form_values['submitted_tree']['company_1'];
it shoes me the key instead of the string value. Eg.$form_values['submitted_tree']['company_1'];
shows '1', which is the key of the selected option.
I tried this, but it still prints the key '1' instead of its value.
<?php
$_page_num = $form_state['values']['details']['page_num'];
$key1 = $form_state['values']['submitted_tree']['company_1'];
$value1 = $form['submitted_tree']['company_1']['#options'][$key1];
$key2 = $form_state['values']['submitted_tree']['company_2'];
$value2 = $form['submitted_tree']['company_2']['#options'][$key2];
if (($_page_num == 2) && ($value1 == $value2))
{
drupal_set_message(print_r($form['submitted_tree']['company_2']['#options'][$key2]));
}
?>
The code which I use to populate the select option is
$array = array();
if ($_SESSION['major'] == 0) {
$sql = db_query("Select data from webform_submitted_data where nid = 2133 and cid = 20 and sid in (SELECT sid FROM webform_submitted_data WHERE nid = 2133 and cid =30 and no = 0) and data not in (SELECT data FROM webform_submitted_data where nid = 2134 and cid=15 group by data having COUNT(*) > 6) order by data ASC");
while($row = db_fetch_object($sql)) {
$array[] = $row->data;
}
}
return $array;
Could anyone help me to retrieve the actual text value displayed in select option chosen. I have tried form_state as well, but it returns the same result.