-1

I need to populate dropdown with data from mysql database, i do that with this code

Maker: <br>
<select name="maker" >
<?php
$sql="select name from makers";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query)){
?>
<option value="<?php echo $row["name"] ?>"><?php echo $row["name"] ?></option>
<?php
}
?>
</select>
<br>

And now i need to change the design and make it little nicer using bootstrap dropdown, but i don't know how to connect this code with bootstrap code for dropdown

Siguza
  • 21,155
  • 6
  • 52
  • 89
zeus
  • 99
  • 1
  • 7
  • 2
    If you can, you should [stop using `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php). They are no longer maintained and are [officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). Learn about [prepared](http://en.wikipedia.org/wiki/Prepared_statement) [statements](http://php.net/manual/en/pdo.prepared-statements.php) instead, and consider using PDO, [it's really not hard](http://jayblanchard.net/demystifying_php_pdo.html). – Jay Blanchard Jun 19 '15 at 19:19

1 Answers1

0

To use the bootstrap-styled selects, just add the form-control class to your <select>:

<select name="maker" class="form-control" >
Mike
  • 23,542
  • 14
  • 76
  • 87
  • thx for answer, how can i change the width of this dropdown because it is along entire page, also other input forms is also too wide. This is code for input forms
    , can you help me with this resizing
    – zeus Jun 19 '15 at 21:19
  • `.form-control { width: theWidthYouWantToUse; }` – Mike Jun 19 '15 at 22:56