Using PHP to generate select boxes | Comments (1)
Posted in Code on 12th December 2004, 7:10 pm by Stuart
I wrote a little tool to assist with generating select boxes from arrays in PHP. If you have got your form already drawn out in PHP and then you decide you need to use PHP to get the selected item from a stored value in a session or database this can be a real pain. Usually you have to create an array of all of your options now this is fine if you are talking about a few items but if it’s a lot of options this tool creates the array for you. Simply paste in theoptions along with their tags. Comes complete with an example function for creating select boxes from arrays too. See Select Box array generator for more info.

Thanks for the code to convert an array to a select list, but could you post the function you use to convert the selectbox to the value-option pairs MD array (Selectbox Converter) used via the form? THAT is what I really need.
Thanks!
http://muffinresearch.co.uk/code/php/select2array/