I have a HTML form that contains many links (around 17). I want, when a link is clicked, the form is submitted using the same ID in the link.
<form id="form" action="some page.php">
<a href='?value=0'>value 1</a><br />
<a href='?value=1'>value 2</a><br />
<a href='?value=2'>value 3</a><br />
<a href='?value=3'>value 4</a><br />
<a href='?value=4'>value 5</a><br />
***********************
**** CLIPPED ****
***********************
<a href='?value=16'>value 17</a><br />
</form>
When a link is pressed, it send me to the same page index.php?value=some number. I want each link to have a certain value/id which when clicked, the form is submitted and sent to some page.php.
Is this possible to be done?
You must use a name on your form:
Add a hidden field:
Then use javascript on your link:
or
And finally, write a javascript:
If your form contains only one field, you can also use a simple link with value: