Jump to content

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>';

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.