HTML doesn't have variables. It's a markup language rather than a programming languages. It doesn't have ifs, it doesn't have variables it just sort of sits there. However you can capture user input using forms (like I did above). When someone clicks the submit button it will send the data to php, depending on the method="" attribute on the <form> tag, the data will either be in $_POST or $_GET variables in PHP.
The example above has method="get" so it send the value of myvar to $_GET['myvar']. It's then incremented in PHP every time.
You can also embed javascript inside of html. This can be used to pass variables between html and php, but I wouldn't recommend it yet. It's pretty complicated. But you can very easily use it to do things like increment a value in the page itself, without the server knowing about it,