PDA

View Full Version : How do I use dynamic drop down in php?



skyline
05-17-2007, 07:08 PM
I want to be able to display 1 to 10 in dynamic drop down menu using php and html code
do not know why it does not working!! can any one help!

echo "<td align='right'><b>Loop Numbers:</b></td>";

echo "<select name='numofloop'>";
for ($i=1; $i=10;$i++) {
echo "<option value='$val'>$val</option>";
}
echo "</select>";

mbrodin
05-17-2007, 10:23 PM
I want to be able to display 1 to 10 in dynamic drop down menu using php and html code
do not know why it does not working!! can any one help!

echo "<td align='right'><b>Loop Numbers:</b></td>";

echo "<select name='numofloop'>";
for ($i=1; $i=10;$i++) {
echo "<option value='$val'>$val</option>";
}
echo "</select>";

Hi, Skyline!
You may change "$val" to "$i" and "$i=10" to "$i < 11", then it works!



echo "<td align='right'><b>Loop Numbers:</b></td>";

echo "<select name='numofloop'>";
for ($i=1; $i<11;$i++) {
echo "<option value='$i'>$i</option>";
}
echo "</select>";


Keep have a nice day!

Best regards,
mbrodin

skyline
05-22-2007, 03:23 PM
Thanks a lot, it did work!

mbrodin
05-23-2007, 09:42 PM
Thanks a lot, it did work!

Nemas problemas! I'm glad it worked! ;)

Best regards,
mbrodin