i have a problem with a drop-box that isn't populated correctly.
echo"<td>Selectati numarul de telefon:</td>
<td><select name='mobil'>
<option value='--'>---</option>";
while($apelantRow = mysql_fetch_assoc($apelantResult))
{
$apel=(string)$apelantRow['nrtel'];
echo "<option value='".$apel."'>$apel</option>";
}
echo"</select></td></tr>";
the sql query works fine. what i get is something like this:
<option value='2'>1</option>
<option value='2'>2</option>
I really don't know what to do. what is confusing me is that i have the same code, on an other page, with different variables and it works just fine.
please help.
thanks, S开发者_运维百科ebastian
Why not
echo '<option value="'.$apel.'">'.$apel.'</option>';
?
EDIT : explicit cast doesn't required as variable is used in a string
精彩评论