Populate a Drop down box from a mySQL table in PHP

后端 未结 7 757
温柔的废话
温柔的废话 2020-11-27 05:40

I am trying to populate a Drop down box from results of a mySQL Query, in Php. I\'ve looked up examples online and I\'ve tried them on my webpage, but for some reason they j

7条回答
  •  有刺的猬
    2020-11-27 06:07

    At the top first set up database connection as follow:

    mysqli->error);
    $query= $mysqli->query("SELECT PcID from PC");
    ?> 
    

    Then include the following code in HTML inside form

    
    

    However, if you are using materialize css or any other out of the box css, make sure that select field is not hidden or disabled.

提交回复
热议问题