i have class
class Form {
public function addTextarea(array $par){
$element='. $par['label'] .';
$element .= '<textarea name="'. $par['name'] .'" id="'. $par['id'] .'" cols="'. $par['cols'] .'" rows="'. $par['rows'] .'" class="' $par['class'] '"></textarea>' ;
return $element;
}
// another form elements
}
$tab1 = array (
'name'=>'newsletter',
'id'=>'nwsltr',
'cols'=>'10',
'rows'=>'5',
'class'=>'newsletter',
'label'=>'Subscribe',
'value'=> $_POST['email']
);
$ob->new Form;
print $ob->addTextarea($tab1);
Did this pattern is good ? How i can simple write array, another write class ?
This one is better
http://sandbox.phpcode.eu/g/fcd58.php