
 Sarah King - 2005-03-01 20:06:58
Thanks for this code. I needed something quick and simple to make a long, dull job easier - if only from the code readability and maintenance point of view. 
At the top of your example you create a form object but the object isn't really necessary, the class is just a way of ensuring that function names don't clash with other code in the system. You could as easily just use 
echo dyna_form::checkbox("q_e19",'1','','','','Plantech’s Risk Researcher');
I hacked the fieldset function to include an anchor tag, and so am contributing it back - cos that's what you do with opensource :) 
Sarah
///////////////////////////////////////////////
function fieldset($_dyna_form_legend,$_dyna_form_classID, $_dyna_form_name='') 
{
  	$_fieldset = '';
    	$_classID = '';
	    if(!empty( $_dyna_form_classID))
	    {
		    $_classID = " class='{$_dyna_form_classID}'";
	    }
	    	    
	    /** generate href # anchor */
	    if (!empty( $_dyna_form_name))
	    {
	    	$_fieldset .= "\n<a name='{$_dyna_form_name}'></a>";
	    }
	    /** generate fieldset/legend tag and attributes */
	    $_fieldset .= "\n<fieldset{$_classID}>";
	    
	    if(!empty(  $_dyna_form_legend))
    	{
	    	$_fieldset .= "\n<legend>{$_dyna_form_legend}</legend>";
    	}
    	return $_fieldset;
}//fieldset