Newbie drop-down lists + db mysql

Hi all,

I’m a newbie in PHP and try to optimize a script with drop-down lists.
Please find attached the .zip with files.
There are :

  • files .sql to create the tables and one to fill the tables (emp_empdetail.sql)
  • report.php to process
  • showreport1.php to display results
  • exemple_he_1.xls, the file given to me to fill the database.

My question is : how to proceed to do that from the .xls file?
You can preview a demo at http://www.fang.ch/pathos/report.php.

Thanks for your coorperation,

Sebastien

I believe you could use foreach to create a drop-down menu that displays information from the database.

You’ll need much more than just a foreach loop. First you have to get the data from the spreadsheet (.xls) into your database. You can do that by first exporting a csv file of your spreadsheet data. Then you can use something like mysql’s load data infile to load the csv data into a database table. Or write your own ascii loader. Once you have the data in a table you can use php to run an sql select statement to extract the table data. Then use a WHILE loop to loop through the sql query’s result set to create your drop down.