if i understand correctly, u want the same form to submit data to two different forms on clicking two different buttons…like if the user clicks save it should go to save form and if clicks on submit, go to submit form…but the form should be common!
if this is the case, you can use the following layout …
<html>
<head>
<script language="javascript">
function validate(mode) {
// do all the form validation stuff you need here
if(mode==1) // this means user clicked on save button
document.forms['userfrm'].action = "savepage.php"; // set the form action to save related server page
else if(mode==2) // this means user clicked on submit button
document.forms['userfrm'].action = "submitpage.php"; // set the form action to submit related server page
// then you can simply submit the form using javascript
document.forms['userfrm'].submit();
}
</script>
</head>
<body>
<form id="userfrm" method="post">
<!-- create all the list of controls u need here -->
<!-- create all the list of controls u need here -->
<!-- create all the list of controls u need here -->
<input type="button" value="Save" onclick="validate(1)" />
<input type="button" value="Submit" onclick="validate(2)" />
</form>
</body>
the outline of this logic is that, we do not set the action of the form right away. we also do not use submit buttons. Instead, we use generic buttons and set a javascript function to their onclick event making them call same function but with different mode values. then in the javascript function, we decide the action of the form based on the mode value and submit the form.