PHP- Fetch from database and store in drop down menu html

后端 未结 4 1608
礼貌的吻别
礼貌的吻别 2020-12-19 19:01

I can\'t seem to get the following code to make a dropdown menu that contains data from a mysql database. The \"include(\'connect.php\');\" connects to the mysql database an

4条回答
  •  独厮守ぢ
    2020-12-19 19:08

    First off, you are missing an option opening tag, as correctly mentioned by stslavik. But this is not causing the issue here as it seems (it's auto-corrected by the browser - in my tests atleast).

    Secondly, this wont work (problem causer):

    echo ""; 
    

    You should use

    echo ""; 
    

    or, as I always prefer single quotes to enclose echo or print output strings:

    echo '';
    

    Third alternative (complex syntax: What does ${ } mean in PHP syntax?)

    echo "";
    

提交回复
热议问题