Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $link=mysqli_connect("localhost","root","");
- mysqli_select_db($link,"dropdown");
- ?>
- <!DOCTYPE html>
- <html lang="pt-br">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <h1>Dropdown buscando campos no banco de dados</h1>
- <form name="form1" action="" method="post">
- <select>
- <?php
- //include ("conexao.php");
- $res=mysqli_query($link,"select * from table1 order by name asc");
- while ($row=mysqli_fetch_array($res))
- {
- ?>
- <option><?php echo $row["name"]; ?></option>
- <?php
- # code...
- }
- ?>
- </select>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement