Jay Blanchard wrote:
I did a quick and dirty of just one of those functions. This function
takes a table and creates a form based on the table. It needs quite a
bit of refining, but I am willing to share and let you guys and gals
throw suggestions;
I use a very similar style of approach, but it's more on a field by
field basis rather than a whole form. I also wrote mine on company
time, so here's an example:
<?php $table = 'customers'; ?>
<form id='search' name='search' action='' method='post'>
<table align='center'>
<tr>
<td align='right'><?php echo UI::getFieldLabel($table,
'first_name'); ?></td>
<td colspan='3'><?php echo
UI::getBlankTextField($table, 'first_name'); ?></td>
</tr>
<tr>
<td align='right'><?php echo UI::getFieldLabel($table,
'city'); ?></td>
<td><?php echo UI::getBlankTextField($table, 'city');
?></td>
</tr>
<tr>
<td align='right'><?php echo UI::getFieldLabel($table,
'state'); ?></td>
<td><?php echo UI::getBlankSelectField($table,
'state'); ?></td>
<td align='right'><?php echo UI::getFieldLabel($table,
'zip'); ?></td>
<td><?php echo UI::getBlankTextField($table, 'zip');
?></td>
</tr>
</table>
</form>
The UI class figures out the max-length of the field, and there are also
configurations to determine what type of field it is (text, phone, date,
textarea, etc.) and security settings based on the user logged in. This
has helped keep my template files very clean, and I still have full
control over the form by not including the fields I don't want.
--
Ray Hauge
www.primateapplications.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php