drcx71276 2016-04-06 03:38
浏览 245

如何使用HTML Dropdown获取数据库值

I am making a Music database site for University using PHPMyAdmin. Right now, I need to make a process dropdown that allows the user to click on a drop down menu of artist names. When the user clicks on one of the given artists and clicks the send button, I want it to link to a page that contains the songs & details of the artist.. These are the Tables. I need the SQL code in order to successfully link these together/ THANKS

Here is the HTML Drop Down code

-- Please select artist name --

    <option>Drake</option>
    <option>ILOVEMAKONNEN</option>
    <option>Justin Bieber</option>
    <option>Kanye West</option>
    <option>Kendrick Lamar</option>
    <option>Post Malone</option>
    <option>ScHoolboy Q</option>
    <option>Taylor Swift</option>
    <option>Travis Scott</option>
    <option>Young Thug</option>
    </select>
            <input type="submit" value="Send">
  • 写回答

1条回答 默认 最新

  • doujiang1832 2016-04-06 04:02
    关注

    From database fetch the artist name. Then use for() or foreach loop() let say it is your arrtist array: $arrArtist =('Drake','ILOVEMAKONNEN','Justin Bieber');

    In html page

    <select name="arrtistname">
    <?php 
    foreach($arrArtist as $artist)
    {
    <?php>
      <option value='<?php echo $artist?>'><?php echo $artist?></option>
    <?php
    }
    ?>
    </select>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料