SirChick Posted August 29, 2007 Share Posted August 29, 2007 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> Quote Link to comment https://forums.phpfreaks.com/topic/67243-solved-drop-down-box-to-a-list-box/ Share on other sites More sharing options...
pocobueno1388 Posted August 29, 2007 Share Posted August 29, 2007 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>'; Quote Link to comment https://forums.phpfreaks.com/topic/67243-solved-drop-down-box-to-a-list-box/#findComment-337290 Share on other sites More sharing options...
SirChick Posted August 29, 2007 Author Share Posted August 29, 2007 A list box : option 1 option 2 option 3 all in one window drop down only shows one but u press the down arrow and scroll through the list which is not so easy scrolling one at a time if theres loads to look through. Quote Link to comment https://forums.phpfreaks.com/topic/67243-solved-drop-down-box-to-a-list-box/#findComment-337291 Share on other sites More sharing options...
pocobueno1388 Posted August 29, 2007 Share Posted August 29, 2007 Did you try what I told you to do? That should give you what you want... Quote Link to comment https://forums.phpfreaks.com/topic/67243-solved-drop-down-box-to-a-list-box/#findComment-337293 Share on other sites More sharing options...
SirChick Posted August 29, 2007 Author Share Posted August 29, 2007 shall give it a try now EDIT yup works a treat cheers ! Quote Link to comment https://forums.phpfreaks.com/topic/67243-solved-drop-down-box-to-a-list-box/#findComment-337296 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.