I have this structure in my page. Secondary form works, and main does not. When I remove secondary, then MAIN works. I would like to keep them both in this structure because I ended my code. Is there any way to manage it? Thank you!
<form name="main" action="result.php" method="post">
. // this form submits some results to result.php
.
.
<form name="secondary" ........>
.
. //this is an ajax form that uploads an image to the server
</form>
.
.
.
<input button>
</form>
Not possible like that, sorry: that is not valid markup – HTML forms do not allow nesting. I’m sorry if that’s inconvenient; as it stands, this will only break in various interesting ways in different browsers, and definitely will not do what you intended.
On a more positive note: the final goal you want is achievable, albeit in different ways:
<form>, maybe just a<fieldset>?<form>; before it’s submitted, it clears the contents of the “inner form”, so the “inner form” fields aren’t submitted with “outer form”