Muffinresearch Labs by Stuart Colville

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.

Post Tools

Comments: Add yours

1. On May 9th, 2008 at 6:38 pm Karl said:

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/







XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Standalone mac battery charger|(0)

Got a spare mac battery? I’ve often wondered why up until now no-one’s produced a standalone charger so that you can charge batteries without having to plug them into the mac. Fortunately Fastmac.com have produced a standalone charger that allows you to do just that. and it’s compatible with iBooks, Powerbooks, macbooks and Macbook Pros. It’s also 110/200v. Exactly what I was looking for!

Django Admin Ominigraffle Stencil|(0)

Colleague Alex Lee has created a nice stencil for omingraffle with the Django Admin UI components, perfect for wireframing customised admin screens. For more details and to download the stencil see Alex’s Blog csensedesign.co.uk

Photos on Flickr

© Copyright 2004-08 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by 1&1 This page was baked in 0.706s.