arth wrote:Thanks.
But my code is :
<select name='price'>
<?php
for($i=1;$i<=100;$i++)
{
?>
<option value="<?php echo $i ?> ">
<?php echo $i; ?>
</option>
<?php
}?>
</select>
What should I add to show 50 as default value selected in the list box?
Thanks in advance.
Why post asking for help and code, and then AFTER getting the info you seek, come back and post your own code asking for that to be fixed?!?
The code I provided originally works fine, lasts long time... but if you want to know how to make your code work as you request (and you don't wish to try to learn by picking apart the code I provided you, then here you go...
<select name='price'>
<?php
for($i=1;$i<=100;$i++)
{
$selected = "";
if($i == 50) {
$selected = "SELECTED";
}
?>
<option value="<?php echo $i; ?> " <?php echo $selected; ?>>
<?php echo $i; ?>
</option>
<?php
}?>
</select>