Reputation: 69
I hope what I'm asking makes sense, but basically let's say I have these forms:
<form method="post" action="/a/url/goes/here">
<!-- some fields -->
</form>
<form method="post" action="/a/different/url/goes/here">
<!-- some checkboxes -->
</form>
<button>SUBMIT</button>
Basically, when the button is pressed the first form's information gets sent to one API and the 2nd forms information gets sent to another API#
Thanks all!
Upvotes: 0
Views: 1196
Reputation: 61
You can simply submit one form and then separate the data. for example you have this form:
<form method="post" action="your_action">
<button type="submit">SUBMIT</button>
</form>
you can send the data to a specified page that has the role of submitting the data to multiple APIs. something like this if you are dealing with php:
$data1 = $_POST['input1'];
$data2 = $_POST['input2'];
and then send $data1 to API1 and $data2 to API2 :)
Upvotes: 1
Reputation: 4769
Simply make a form with all the fields you needed for both APIs
<form action="action_path" method="post">
All the data you need should be in here. Between these form tag.
</form>
And in the action_path
, you can separate the data as per the requirements of the APIs and call those APIs sending the data.
lets say you have all the data in $_POST. Assign the data to variable like
$a = $_POST['name'] , $b = $_POST['name2']
and so on.
The you can do anything you want with those data. Send $a to API1
and $b to API2
Upvotes: 1