elementin action */ function create_form($data,$form_info,$form_act,$noform=false) { // global $outbuff; //print"noform=".$noform; if(empty($form_act['onsubmit']))$form_act['onsubmit']=""; $form=""; if(!$noform)$form.="
"; $form.=""; $textarea_default_size="rows=6 cols=40"; $textbox_default_size="size=30"; // print_r($form_info); if(!empty($form_info)){ while (list($a, $b) = each($form_info)) { // print "data=".$a.",values=".print_r($b); // print_r($b); if(empty($b['id']))$value=$a; else $value=$b['id']; $label=$b['label']; if(!empty($b['size']) && isset($b['size']))$textbox_default_size="size=".$b['size'].""; if($b['form_ignore']==true)continue; if(empty($data[$value]))$data[$value]=$b['default']; switch($b['type']) { case 'text': $form.=""; break; case 'select': //print_r($data); $form.=""; break; case 'checkbox': //print $val." ".$data[$value]; //print_r($data); //print_r($form_info[$value]); //print_r($form_info); $form.= ""; // foreach($b['default'] as $val) // { if($data[$value]['default']==1)$form.=""; else if(empty($data[$value]['default']) && $form_info[$value]['default']==1){ $form.=""; } else $form.=""; // } $form.= ""; break; case 'hidden': $form.=""; // TODO tarvitseeko hiddenin olla taulun solussa? break; case 'visible': $form.=""; $form.=""; break; case 'password': if($b['required']==false)$form.=""; else $form.=""; break; case 'textarea': $form.=""; break; case 'file': $form.=""; break; case 'radiobutton': $form.=""; break; case 'submit': $form.=""; break; //case 'checkbox': // if($label==0) $form.=""; //else $form.=""; // break; } $textbox_default_size="size=30"; } } $form.="
$label
$label
$label
$label$data[$value]
$label
$label
$label
$label
$label
"; if(!$noform)$form.="
"; return $form; } ?>