开发者

why won't my drop-box be populated correctly using a while statement?

开发者 https://www.devze.com 2023-01-23 20:45 出处:网络
i have a problem with a drop-box that isn\'t populated correctly. echo\"<td>Selectati numarul de telefon:</td>

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

0

精彩评论

暂无评论...
验证码 换一张
取 消