Populate Combobox From MySQL Table query

Issues related to forms.
Post Reply
Saints13
 
 
Posts: 2
Joined: Tue Jan 21, 2020 4:22 pm

Populate Combobox From MySQL Table query

Post by Saints13 »

Hi,

I'm working on a page that requires the user to select an option from a combobox (type : listbox). Rather than explicitly type the option values into the combobox, I would like to pull in the values from a MySQL table - via suitable query and HTML/PHP code? I have looked all over the forum for advice/guides as to how to populate the text & values this way, however can't seem to find anything other than an old forum entry from 2015 which gave a pre SQLi solution. I have tried this (converted to SQLi) and it doesn't populate the values. Is this solution still relevant ? (by Feedrich » Fri Mar 20, 2015 4:46 pm)

Am I missing something really simple here? Or is it a complicated coding solution ?

NB: As a test, I can create a Select box and populate from a table/query via HTML and PHP, however, the solution is nowhere as neat as the possible webbuilder combobox .....

Advice appreciate.

Dougie.
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Populate Combobox From MySQL Table query

Post by Pablo »

I'm sorry, there is no standard solution for this. This will require PHP coding.
Saints13
 
 
Posts: 2
Joined: Tue Jan 21, 2020 4:22 pm

Re: Populate Combobox From MySQL Table query

Post by Saints13 »

Thanks for quick response. I just tried again - this time with data in the table :oops: , and the 2015 solution updated for SQLi does work :D

D.
texelbee
 
 
Posts: 17
Joined: Thu Oct 18, 2018 5:40 pm

Re: Populate Combobox From MySQL Table query

Post by texelbee »

Hello, Saints13! Would you be willing to share how you accomplished that?
Post Reply