At 15:04 17-6-03, you wrote:
I'm constructing an HTML form (via PHP) in which I want the user to be able to add or delete elements as needed.

For instance, in a page detailing user information, the user might have one phone or several. Rather than having a set number of slots for phone numbers I'd have one slot and have a button by which the user could add a slot. The user could also delete a number in a similar manner.

The design goal is something like Apple's iTools web page construction tool. Beside each slot is a "-" and a "+" to delete that slot or to add another one just under the existing slot.

I've got something worked out that is beginning to work, but I wondered if anyone on the list had faced a similar problem or knows of an example script that handles a problem like that.
If the # of phone numbers is limited, then i think i would just make say 10 phone fields in the database, and only show the non-empty ones.
Simply wander through the query results (phone1, phone2 etc) and do not show the empty ones. Let the [+] button open an edit childwindow with the first empty available phone field. Or very nice: use DHTML to do it.


If the # of phone numbers is unlimited, you can chose: throw all numbers in one field, with delimiters between them, and split them when you are using them, or use an array (use

The relational database choice would be to have a separate table 'phone numbers' with a field userID and a filed phone:
userID | phone
1 | 1113456798
1 | 98709321
2 | 0293720973
1 | 398731273
14 | 92827981398
14 | 938721
etc






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to