How to place title/label in other cell of the html table
I have:
function hook_theme() {
return array(
'hook_form_table' => array(
// The renderable element is the form.
'render element' => 'form',
),
);
}
function hook_form_table_form($form = array(), &$form_state) {
$form['#theme']= 'hook_form_table';
$selected_two="";
$options_second=array("a");
$form['carmodel'] = array('#type' => 'select',
'#options' => $options_second,
'#default_value' => $selected_two,
'#required' => TRUE, '#title' => t('Car model:'),
'#validated' => true,
'#prefix' => '<div id="replace_carmodel_div">',
'#suffix' => '</div>',
);
$options_euro=array("Euro 3,4","Euro 5" );
$form['euro'] = array('#type' => 'select',
'#options' => $options_euro,
'#default_value' => $selected_two,
'#required' => TRUE,
'#title' => t('Euro type:'),
'#validated' => true,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}
function theme_hook_form_table(&$variables) {
$form = $variables['form'];
$content = '<h2>' . t('Please enter your information below') . '</h2>';
$content.="<table>";
$content.="<tr>";
$content.="<td>";
$content.=$form['carmodel']['#title'];
$form['carmodel']["#type"]="";
$content.="</td>";
$content.="<td>";
$form['carmodel']['#title']="";
$form['carmodel']['#required']="";
$content .= drupal_render($form['carmodel']);
$content.="</td>";
$content.="<td>";
$content.="hire want euro type with * and label and all";
$content.="</td>";
$content.="<td>";
$content .= drupal_render($form['euro']);
$content.="</td>";
$content.="</tr>";
$content.="</table>";
return $content;
}
This give me a table but labels is on top: How to render label to put it like this: