Skip to content
Advertisement

How to submit 3 different forms with just one button in PHP

I am creating a multi-step form and need to ”upload”/save some information into a database. It consists of 3 forms. The problem is that only the last form is sending the information and that’s also where the submit button is.

Code sample below:

JavaScript

As I said, only the last form is sending the data to another php file in the same root folder (./edit_info.php), to be saved in the database:

JavaScript

That said, only $empregador1 = mysqli_real_escape_string($conn, $_POST[“cempregador1”]); is receiving the data.

Any help will be welcome!

Advertisement

Answer

Make a button and use jQuery for button click, from there you can bundle all the data from those forms using serialize() function in to single json array if data is to be submitted to one place.

or simply just create one form from those three

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement