NYCPHP Meetup

NYPHP.org

[nycphp-talk] Examples of HTML forms/user interfaces.

Mitch Pirtle mitchy at spacemonkeylabs.com
Wed Jan 21 10:08:03 EST 2004


Matthew Zimmerman wrote:

> Hello List,
> 
> I was wondering if anyone had any good tutorials or examples for 
> designing HTML interfaces/forms for data entry into a MySQl database.

PEAR::HTML_Quickform is one really great way to get started with more 
complex forms, and also generates validation rules (both client-side and 
server-side); and best of all the package comes with documentation and 
some great examples, including your multiple-musician scenario.  I would 
suggest taking a look there.  There's also a much more advanced 
controller mechanism for multiple-part forms, but luckily I haven't had 
to get into that.

> In the past my databases have been quite simple so I could have text boxes 
> and pull down menus for data entry. The database I am working on now has 
> some more "advanced" features such as allowing a user to add more than 
> one value per field and also allowing the user to update controlled 
> vocabulary in look up tables. For instance there is a field called 
> "musician" but often I there can be more than one musician. My DB schema 
> is fine and normalized, and my programming logic is fine too. But I am a 
> bit over my head in making a easy user interface for these things.

One (old) trick is to give all of the musician form items the same name 
in an array nomenclature, that way you could iterate over the 
$musician[] array for each value. That should make it easy to deal with 
getting "n" musicians from the form.

If there is enough demand then I guess I just found the topic for my 
next tutorial...  ;^)

-- Mitch



More information about the talk mailing list