Jump to content

[SOLVED] Drop down box to a list box


SirChick

Recommended Posts

Need some help guys, i have this drop down box that displays the relevant info from the table that its loading.

 

But the drop down box isn't quite so wise to use if there hundreds of rows. So what i wanted to do was change it to a list box instead ... would any one know how to do that?

 

This is the drop down box im using at the moment:

 

<form name="Form1" method="POST" action="housepurchaseprocess.php" enctype="multipart/form-data" id="Form1" onsubmit="return ValidateForm1(this)">

<?php
$soldhousesquery = "SELECT Price, HouseType FROM soldhouses ORDER BY Price ASC";
$soldhousesresult = @mysql_query($soldhousesquery) or die(mysql_error());


echo '<select name="houselist">';

while($soldhousesrow = mysql_fetch_array($soldhousesresult)) {
        echo "<option value=\"{$soldhousesrow['Price']}|{$soldhousesrow['HouseType']}\">£ {$soldhousesrow['Price']} - {$soldhousesrow['HouseType']}</option>";
}

echo '</select>';
?>
</div>
<input type="submit" id="Button2" name="Buy" value="Buy House" style="position:absolute;left:350px;top:500px;width:184px;height:24px;z-index:3">
</form> 

Link to comment
https://forums.phpfreaks.com/topic/67243-solved-drop-down-box-to-a-list-box/
Share on other sites

Whats the difference between a dropdown box and a list box?

 

If your referring to a listbox being the same thing as a drop-down, just with more choices showing, then you just have to add the "size" attribute.

 

echo '<select name="houselist" size=10>';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.