Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. <?php
  2.     $host = 'localhost'; // Host name Normally 'LocalHost'
  3.     $user = 'root'; // MySQL login username
  4.     $pass = ''; // MySQL login password
  5.     $database = 'test'; // Database name
  6.  
  7.     mysql_connect($host, $user, $pass);
  8.     mysql_select_db($database);
  9.  
  10.     $sql="SELECT thing FROM dropdown";
  11.     $result=mysql_query($sql);
  12.  
  13.     $options="";
  14.  
  15.     while ($row=mysql_fetch_array($result))
  16.     {
  17.         $thing=$row["thing"];
  18.         $options.="<OPTION VALUE=\"" . $thing . "\">" . $thing;
  19.     }
  20. ?>
  21. <SELECT NAME=thing>
  22. <OPTION VALUE=0>Choose
  23. <?=$options?>
  24. </SELECT>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement