I have a few <div> inside a forms, each thing inside the div contains a specific form.
When a user presses the submit button, I want to execute a different action based on
<form method="get" action="addprogramtodb.jsp">
<select name="cid" style="display: none;">
<option>1</option>
<option>2</option>
</select>
<div id="1">
</div>
<div id="2">
</div>
<div id="3">
</div>
<input type="submit"/>
</form>
When the user presses the submit button I want the program to execute different queries based on what div it is in…. based on the div id, or somehow..
Give the submit button a name and value the usual way.
The pressed button is namely available as request parameter as well.
You can if necessary give them a different name instead and then nullcheck each request parameter.
with
Or, if they are actually all in their own
<form>, then you can also pass a hidden input along.with the same server-side handling as in 1st example.