Deano
Deano

Reputation: 176

PHP Process 2 forms at once

I would like to know if its possible to process 2 forms at once? my scenario is this:

I have a contact page on my website which consists of:

section 1 is always the same is a form on its own, where as section 2 will only show details for one of the options (selectable from drop down box.)

so in total I have 4 forms of which 2 will always be filled in, and i need to process them both to email through to me. I don't want to have to include section 1 at the top of each form if i can help it)

I hope this all makes sense.

Upvotes: 1

Views: 136

Answers (3)

Tom
Tom

Reputation: 913

You can only submit one form at a time. You have a couple of options:

1) Combine the two forms into one form and use CSS/JavaScript to show/hide the relevant fields. This way, all of the form fields will be submitted (including the ones you're not interested in). This is what I would do.

2) When the user submits the form, use JavaScript to send the appropriate data to the backend.

Upvotes: 1

Anonymous
Anonymous

Reputation: 1979

Any reason you dont want to make it one form? Seems like it would be a lot easier to make it one form and do all of the processing on the other side.

Upvotes: 1

Jan.
Jan.

Reputation: 1995

Long story short: You can only submit one form at a time.

Upvotes: 1

Related Questions