Here's the scoop....
I'm trying to create a form function which basically will allow me to rapidly deploy forms for sites.
I've created several user defined functions that allow me to display input boxes, validate submitted fields etc. That all seems to work just great. The issue I've come across is that I've created the following function...
function formtable($width,$tableheading,$bgcolor,$cellpadding,$cellspacing,$border, $class1='tdheader', $class2='tdnorm') {
GLOBAL $tableitems, $form;
print "<form method='$form[method]' action='$form[action]' name='$form[name]'>\n";
print "<table width='$width' bgcolor='$bgcolor' cellpadding='$cellpadding' cellspacing='$cellspacing' border='$border'>\n";
print "<tr>\n";
print "<td class='$class1' colspan='2'>$tableheading</td>\n";
print "</tr>";
foreach ($tableitems as $tkey=>$tvalue) {
print "<tr>\n";
print "<td class='$class2' valign='top'>$tkey</td>\n";
print "<td class='$class2'>";
print $tvalue;
print "</td>\n";
print "</tr>\n";
}
print "<tr>\n";
print "<td colspan='2' align='right'>";
submit(submit,submit,reset,reset);
print "</td>\n";
print "</tr>\n";
print "</table>\n";
print "</form>\n";
}
You'll notice that is has access to the GLOBAL variable $tableitems. This function will allow me to properly display my needed form elements into a nice table by parsing through the $tableitems array.
The table items is an associative array as follows...
$tableitems = array("Name"=>"inputdbase(Name',text,name,'select name from form where id=1',25)",
"Email"=>"textareadbase(Email,email,'select email from form where id=1')");
Basically what happens is that the key value in this array consists of another 1 of my user defined functions (eg. inputdbase).
The real issue is that when I run the formtable function everything works BUT I'm expecting it to display my user defined function eg. inputdbase, properly but it displays it as just text, not the input box I want. The function is not recognized. I've tried everything I can think of. I thought it had something to do with quotes and what not but I'm not to sure.
Is there something I'm missing or another workaround possibly? Any help or leads are appreciated.
Thanks.