# Trying to submit 2 forms with 1 button, Almost works.. Help?

**URL:** <https://forum.kirupa.com/t/trying-to-submit-2-forms-with-1-button-almost-works-help/194234>\
**Category:** Uncategorized\
**Created:** [July 21, 2006, 2:49pm UTC](https://forum.kirupa.com/t/trying-to-submit-2-forms-with-1-button-almost-works-help/194234 "2006-07-21T14:49:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcgmark](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@mcgmark](https://forum.kirupa.com/u/mcgmark)\
**Post date:** [July 21, 2006, 2:49pm UTC](https://forum.kirupa.com/t/trying-to-submit-2-forms-with-1-button-almost-works-help/194234/1 "2006-07-21T14:49:43Z")

</div>

I am trying to submit 2 forms with 1 button. Reason is I need to have 1 cgi script to submit the form and e-mail the data and the second cgi script to upload a file to our server.

Both cgi scripts work perfectly.

BUT, when I hit submit the first form loses its user input. But works I get an e-mail with my generic message just not the form data.

Now the second form for the file upload works perfectly. File uploads and I get an email with the file name so it’s not losing that data…

Any ideas why I am losing the first form’s data?

I even tried reversing the order at which it submits and I still only lose the first forms data.

I am using this javascript

> \<script type=“text/javascript”\>  
> \<!–//  
> function f1Submit() {  
> document.f1.submit();  
> }

function f2Submit() {  
document.f2.submit();  
}

function submitAll() {  
f1Submit();  
f2Submit();  
}  
//–\>  
\</script\>
