You must use the DOM-API to obtain the required data. Since the <select>
element is not so complex, you can get all the <options>
nodes using getElementsByTagName
:
$select = $this->Dom->getElementById('DDteam'); $options = $select->getElementsByTagName('option'); $optionInfo = array(); foreach($options as $option) { $value = $option->getAttribute('value'); $text = $option->textContent; $optionInfo[] = array( 'value' => $value, 'text' => $text, ); } var_dump($optionInfo);
source share