Re: Designing an input form for one-to-many etc.
| From: | Koos van den Hout | Date: | Sun, 08 Oct 2000 11:53:19 +0000 |
| Subject: | Re: Designing an input form for one-to-many etc. | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-3409@lists.php.net to get a copy of this message | ||
Quoting Mike Erickson who wrote on Sat, Oct 07, 2000 at 02:26:10PM -0700:
> I have a similar problem. I am writing an online contact database and
> people may have an arbitrary number of phone numbers, email addresses,
> etc. and I haven't figured out a good way to have them input the
> information, other than just having them re-use the form and append
> data; but I hate that approach. I'd like to see your code.
For 'just' one-to-many problems, there is the following approach:
Give multiple input-fields with variable phonenumber[] (including the []).
On processing the form you'll have the array phonenumber that you can walk
through with each().
The easiest way for an update-form is to give a number of extra
phonenumber[] fields, and on processing the update delete all the
associated phonenumbers connected to the record and insert them from the
form.
Koos
--
Koos van den Hout, PGP keyid RSA/1024 0xCA845CB5 via keyservers
koos@kzdoos.xs4all.nl or DSS/1024 0xF0D7C263 -?)
Fax +31-30-2817051 Visit my site about books with reviews /\\
http://idefix.net/~koos/ http://www.virtualbookcase.com/ _\_V