Frederikoo

dropdown

Oct 24th, 2011
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php
  2. mysql_connect("localhost", "user", "pw") or die(mysql_error());
  3. mysql_select_db("DBName) or die(mysql_error());
  4. $query="SELECT tsName FROM users";
  5. $result = mysql_query($query);
  6.  
  7. echo '<select name="users">';
  8. while($nt=mysql_fetch_array($result)){ //Array or records stored in $nt
  9. echo '<option value="' . $nt['id'] . '">' . $nt['name'] . '</option>';
  10. /* Option values are added by looping through the array */
  11. }
  12. echo '</select>'; // Closing of list box
  13. ?>
  14.  
Advertisement
Add Comment
Please, Sign In to add comment