Jump to content

[SOLVED] submit multiple forms at once?


simon551

Recommended Posts

What I am trying to accomplish doesn't seem totally unique so it very likely the way I am asking the question which is keeping me from finding the answer.

 

This is an expense report problem. I have 3 tables that make up an expense report: expensereport, erDets, and erSplits.

 

The reason for the 3rd table is that in some cases the employee will need to split an expense into multiple lines due to multiple projects being covered by one expense item. What I want to do is create an interface that makes it seem like the user is entering into just 2 tables (expensereport, details) so the need I have is to combine the 2 tables (erDets, erSplits) into one form -- or at least the appearance of one form.

 

an idea I have is to have just one button that submits both forms. Could I make a button that when clicked would do the following?

 

1. query one: insert into erDets (form1)

 

2. retrieve the newly created key --$var = mysql_insert_id()

 

3. query two: insert into erSplits ($var,  form2)

 

Maybe there is a better way to accomplish this?

Link to comment
https://forums.phpfreaks.com/topic/50418-solved-submit-multiple-forms-at-once/
Share on other sites

I guess because currently that's as far as my understanding goes: I can submit a form into a table. I can retrieve the newly-created key field. and then I can use that key field in another form.

 

I don't know how to do it all in one step. One form would be great. Maybe that is what I should be looking at.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.