Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.