By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,725 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Multiple form submit using single button

P: 21
Hi,

I need to submit multiple forms with using single button. I've mentioned my code below.

<?
if(isset($_POST)){
print_r($_POST);
}
?>
<script type="text/javascript">
function form2Submit() {
document.f2.action="formsubmit2.php"
document.f2.submit();
alert('Form2 Submitted');
}

function form1Submit() {
document.f1.action="formsubmit2.php"
document.f1.submit();
document.getElementById("t1").value = '';
alert('Form1 Submitted');
}


function submitAllForm() {
form1Submit();
form2Submit();
}
</script>
</HEAD>

<body>
<form name="f1" method="post">
F1 NAME: <input type="text" name="t1" id="t1" size="24" value="txt1" />
</form>
<form name="f2" method="post">
F2 NAME: <input type="text" name="t2" id="t2" size="24" value="txt2" />
</form>
<input type="button" value="Submit" onClick="submitAllForm()" />
</body>

Its working properly in IE but not in Mozilla. do you have any idea ?

Thanks.
Dec 20 '07 #1
Share this Question
Share on Google+
1 Reply


rpnew
100+
P: 188
Hi,

I need to submit multiple forms with using single button. I've mentioned my code below.

<?
if(isset($_POST)){
print_r($_POST);
}
?>
<script type="text/javascript">
function form2Submit() {
document.f2.action="formsubmit2.php"
document.f2.submit();
alert('Form2 Submitted');
}

function form1Submit() {
document.f1.action="formsubmit2.php"
document.f1.submit();
document.getElementById("t1").value = '';
alert('Form1 Submitted');
}


function submitAllForm() {
form1Submit();
form2Submit();
}
</script>
</HEAD>

<body>
<form name="f1" method="post">
F1 NAME: <input type="text" name="t1" id="t1" size="24" value="txt1" />
</form>
<form name="f2" method="post">
F2 NAME: <input type="text" name="t2" id="t2" size="24" value="txt2" />
</form>
<input type="button" value="Submit" onClick="submitAllForm()" />
</body>

Its working properly in IE but not in Mozilla. do you have any idea ?

Thanks.
Hi,

Whats the error you are getting???

Regards,
RP
Dec 21 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.