wispas Posted March 11, 2010 Share Posted March 11, 2010 I have a lists of hotel names in a drop down menu: <?php // Connect database include("connectdb.php"); $sql="SELECT hotel_id, hotel_name FROM hotel ORDER BY hotel_name ASC"; $result=mysql_query($sql); $options=""; $id_array = array(); $hotel_name = array(); while ($row=mysql_fetch_array($result)) { $id_array[]=$row["hotel_id"]; $hotel_name[]=mysql_real_escape_string($row["hotel_name"]); $options.="<option VALUE='".$row["hotel_id"]."'>".$row["hotel_name"]."</option>"; } ?> <select name="hotel_name" size="1" style="background-color:#FFFFD7"> <?php echo $options; ?> </select> I want to display a default hotel based on its value... say i want the drop down to be on hotel id 35 when the page loads... does someone know how i can achieve this... ? Link to comment https://forums.phpfreaks.com/topic/194930-displaying-sql-data-drop-down/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.