Reputation: 6903
how can I submit the form2 automatically when I submit the form1?
if( $_POST['submit'] == 'Submit')
{ im going to put my form2 here then automatically submit.
what code do i need?}
<form name=form1 action=# method=post>
<input type=submt name=submit value=Submit />
</form>
NOTE my form2 have different action that's why I cant include the content of my form2 to my form1
It can also be, when I click something, those two form will be submitted.
Upvotes: 0
Views: 2130
Reputation: 2461
As simple function would do that (if I've got your question right :-S)
function submitForm()
{
document.form2.submit();
}
Call this function from the submit
<input type="submit" onclick="submitForm();"/>
Upvotes: 3
Reputation: 2161
Link the onsubmit event of each form to a new function "launchMyForms". In these function launch your forms manually:
$('#myform1').submit();
$('#myform2').submit();
Upvotes: 1