multi select lists and php
Posted: Sat Oct 02, 2010 11:03 pm
Hi guys. I'm a newbie at PHP programming and I've been playing around with using multi select lists to load external files. My situation is as a practice in using PHP, I've created 3 recipe .txt files. These three files can be loaded through a multi select list. Eg: I have a cheese sandwich recipe file and the cheese sandwich option in the multi select list. When the user clicks on cheese sandwich and then hits 'Submit', it loads and returns the external file.
Anyway I've figured out how to use it with using the 'Switch' function, just switching through to each appropriate file. But I've realised while this might be okay for 3-5 recipe choices, what if I had 20-40 recipes instead? It would be incredibly tedious to write all that code for each option, plus it would just slow everything down too. Not good.
I know it has something to do with putting the recipe choices in an array, I've played around with that too but haven't been very successful. Thanks guys
Anyway I've figured out how to use it with using the 'Switch' function, just switching through to each appropriate file. But I've realised while this might be okay for 3-5 recipe choices, what if I had 20-40 recipes instead? It would be incredibly tedious to write all that code for each option, plus it would just slow everything down too. Not good.
I know it has something to do with putting the recipe choices in an array, I've played around with that too but haven't been very successful. Thanks guys