PHP scripts and programs for Beginner to Master

php programs, php ready to use scripts & functions, css tutorials, html, javascripts, ajax examples for Beginner to Master

While working on a project you might need a dynamic select box to be generated from the values present in the database.
So this example gives you a simple way to populate a select box with the values present in the database.

Consider a example - there is a table "article" in your database "mydb"

So for this first we need to create a connection with the database and we need to select the database.

For this we will create a file called "connect.php"

replace the values with your actual values as per directed in code



After that we will write our main code in a file called "myselect.php"



And its over. Its very simple.
Try it out, if you face any problem then comment here, i will help you.

I'm reading: Fill select tag with php - fill select tag of form with phpTweet this!

0 comments:

Post a Comment