Php – send $_POST data via anchor tag

anchorhtmlphppost

is it possible to somehow send $_POST[] data via a <a> tag? because it seems to automaticly execute the $_POST[] once the page loads rather than when I press the Anchor tag.

edit:
so what I'm trying to achieve is something like this:

I want an anchor tag which would normaly go to somepage.php?variable=something
but instead of using $_GET[] I want to send the variable via $_POST

Best Solution

Nothing in HTML will cause a link to trigger a POST request or encode data in the request body.

You can bind a JavaScript event handler to a link, cancel the default behaviour and then send a POST request by programmatically submitting a form or using XMLHttpRequest. This generally isn't a good idea and you should use a submit button instead (which you can style to look like a link if you really, really want to).