Using PHP to populate a <select></select>?

前端 未结 7 1252
面向向阳花
面向向阳花 2021-01-11 23:50

I want to populate the above tag with values from database.

I have written php code up to t

7条回答
  •  渐次进展
    2021-01-12 00:19

    All the above answers will work, but are not proper and require extra work. You should not use echo to output to the screen and you don't have to. The below example assumes you are using objects containing data, but you get the idea.

    
    

    The point being you don't have to echo out the html

提交回复
热议问题