SOAP with custom form select I'm getting results from a SOAP call, but cannot display the values in a  select list on my custom module.
This is a part of my code:

foreach($sxml2-&gt;NewDataSet-&gt;DepCity as $item) {
    $fromName = $item-&gt;Name;     
    echo '&lt;li&gt;' . $fromName . '&lt;/li&gt;'; //It displays correctly  


    $form['from'] = array(
        '#type' =&gt; 'select',
        '#title' =&gt; t('From'),
        '#options' =&gt; $fromName, 
    );      
}


$sxml2 is a simplexml load string result and it's display correctly.
When I echo the result from the loop ($fromName), I'm getting all the strings properly, but If I try to put that variable in a custom form select, it doesn't display any data.

How can I get the results in a Drupal form select?

EDIT:

I've tried with this, but it still doesn't display anything in that select.

echo '&lt;pre&gt;';
print_r($sxml2); //The whole simpleXML object with arrays is displaying properly    
echo '&lt;/pre&gt;';


$options = array();
foreach($sxml2-&gt;NewDataSet-&gt;DepCity as $item) {
  $options[$item-&gt;Name] = $item-&gt;Name;
  echo '&lt;li&gt;' . $item-&gt;Name . '&lt;/li&gt;'; //It displays correctly  

}

$form['from'] = array(
  '#type' =&gt; 'select',
  '#title' =&gt; t('From'),
  '#options' =&gt; $options, //It doesn't display the data
);
The #options property should be an array of key value pairs (the key is the &lt;option&gt;'s value attribute, the value is the content of that tag), so:

$options = array();
foreach($sxml2-&gt;NewDataSet-&gt;DepCity as $item) {
  $options[$item-&gt;Name] = $item-&gt;Name;
}

$form['from'] = array(
  '#type' =&gt; 'select',
  '#title' =&gt; t('From'),
  '#options' =&gt; $options,
);


That's just for demonstration, you may wish to use something other than a name for the option key - it's the sort of thing that would clash easily.