I'm working with a page where I'm trying to submit data when a link is clicked. I already know how to do this with POST and GET using javascript buttons, but how do I get the same effect when I'm working with HTML links?
To add a URL variable to each link, go to the Advanced tab of the link editor. In the URL Variables field, you will enter a variable and value pair like so: variable=value. For example, let's say we are creating links for each store and manager.
Submitting form values through GET method A web form when the method is set to GET method, it submits the values through URL. So we can use one form to generate an URL with variables and data by taking inputs from the users.
If you have a plain link you can pass them as query parameters on the link (which is a GET operation)
<a href="/myapp/somecontroller.php?id=17&name=fred">Save</a>
If you have a plain HTML form with no javascript to handle the button press you can put things in hidden fields
<form name="theform" method="post" action="/myapp/somecontroller.php">
<input type="hidden" name="id" value="17">
<input type="hidden" name="name" value="fred">
...
</form>
This doesn't require any javascript.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With