Holas,
De lo que haces:
Código PHP:
$sQuery = mysql_query("Select PaisId, NombrePais from paises");
$paises = mysql_fetch_array($sQuery);
foreach($paises->result_array() as $row)
{
$first_options = array($row['PaisId'] => $row['NombrePais']);
}
<select name="first_select" id="first_select" onchange="test()">
<option value="0"></option>
<?php
if (isset($first_options))
{
foreach ($first_options as $key=>$value)
{
echo '<option value="'.$key.'">'.$value.'</option>';
}
}
?>
</select>
Podria ser mejor hacerlo asi:
Código PHP:
<?php
$sQuery = mysql_query("Select PaisId, NombrePais from paises");
?>
<select name="first_select" id="first_select" onchange="test()">
<option value="0"></option>
<?php
while($row = mysql_fetch_array($sQuery))
echo '<option value="'.$row['PaisId'].'">'.$row['NombrePais'].'</option>';
?>
</select>
Creo que asi podrias tambien hacerlo en menos codigo y sin mucho bucle.
Saludos
Gildus