passing a variable with href in html

html, php

Solution

Yes it is possible by doing the following

site 1

<input type="button" onClick="window.location='http://example.com?var=<?php echo $var ?>'">

On the recieving site use the following:

site 2

<?php
    $var = $_GET['var'];
?>

The variable you sent is store in $var in site 2

Problem

I want to pass a variable along with the link on a button click, while using href. can anyone tell me the exact syntax or if it is even possible? i want to do something like this: href="link+variable" so that i can extract the variable and use it on the "link" which will open.

Original source