Page 1 of 1

Sub-form (master-detail form)

Posted: Fri Jan 26, 2007 9:57 pm
by bloodflower
hi all,

I have a problem creating a "subform" in PHP. I use MySQL as my database.

what i want to create is a Sales Order form that submit data to database. It has Document No. as the master's Primary Key, and Document No. and Line No. as the child's Primary key.

For the illustration:
================================| Master
Document No : SO-0001 |
Order Date : 01/27/07 |
================================|Detail
Line No. | Item No. | Quantity |
======== |====== |================|
1 | OP-001 | 1,000 |
2 | OP-002 | 1,500 |
3 | OP-003 | 2,550 |
=================================

i hope you can help me solve my prob.. thx

Posted: Sat Jan 27, 2007 9:19 am
by feyd
Sorry, I have no idea what, specifically, you're asking.

Posted: Sat Jan 27, 2007 10:42 am
by louie35
In the Detail table you need to have a reference to the Master table like the "Document No" otherwise how are you going to now what and when?

For the illustration:
================================| Master
Document No : SO-0001 |
Order Date : 01/27/07 |
================================|Detail
Line No. | Item No. | Quantity | Document No. |
======== |====== |================|
1 | OP-001 | 1,000 | SO-0001 |
2 | OP-002 | 1,500 | SO-0001 |
3 | OP-003 | 2,550 | SO-0001 |
=================================

Posted: Sat Jan 27, 2007 11:00 am
by RobertGonzalez
Form and subform sound quite a bit like Access. What is your intended implementation of this? I only ask because it sounds almost like you want a form with another form that is related to the main form that you can interact with while not messing with the main form. If that is the case, this is just a simple select query where the subform is the form in which you actually capture the data, then post it back for processing.