Suppose I want to make a form for entering a new species of okaymon. enter the name of species: enter the weight: energy type: Would like a function to produce the html for *any* dropdown: /* dropdown : string, string[] -> string */ function dropdown( $name, $options ) example: $energies = array("puddle","spark","clover","dirt"); test( dropdown( "energy", $energies ), " " ); How to let people enter what energies this species is weak to? weak to: __ puddle __ spark __ clover __ dirt resistant to: __ puddle __ spark __ clover __ dirt Hmm, two sets of check-boxes would allow the user to input inconsistent info. We'll try a table full of radio buttons: weak neutral resistant puddle: O O O spark: O O O clover: O O O dirt: O O O Let's make a function to create these things! // radioTable : string, string[], string[] -> string function radioTable( $id, $rowNames, $colNames ) radioTable( $energies array("weak", "neutral", "resistant") ) test( radioTable( "fruitses", array("apples", "bananas", "kumquats"), array("blech", "yummy") ), << yech yummy apples bananas kumquats MY_SAMPLE_OUTPUT ); blech yummy apples: O X bananas: X O kumquats: X O // later, in the form handler $_POST['species'] === "Mewthree" $_POST['weight'] === "32" I want something "$_POST['fruitses']" === array( "apples" => "blech", "bananas" => "yummy", "kumquats" => "yummy" ); We can indeed do this by making each radio-button's name attr. start with "fruites[...]" Now we have: $_POST['fruitses']['apples'] === "blech" $_POST['fruitses']['bananas'] === "yummy" $_POST['fruitses']['kumquats'] === "yummy" test( radioTable( "fruitses", array("apples"), array("blech", "yummy") ), << yech yummy apples MY_SAMPLE_OUTPUT ); test( radioTable( "fruitses", array(), array("blech", "yummy") ), << yech yummy MY_SAMPLE_OUTPUT ); test( radioTable( "fruitses", array(), array() ), << yech yummy MY_SAMPLE_OUTPUT );