Saturday 22 December 2018

How to display db results as options in HTML dropdown with PHP and Mysqli?




I am trying to to let users choose the state filed from a drop down in the form, but although the query works, the DB is connected, the drop down does not display the list.



Not sure if relevant but i'm running Windows Server, IIS 10 and the latest PHP and MySql.















I expect the list from the DB to be in the dropdown, but it is empty (No dropdown list).


Answer



delete your first



$row1 = mysqli_fetch_array($result1);


line &
put your two variables(result & row1) in var_dump to get debug


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...