There are numerous tutorials out there … This could be as simple as:
<?php if(isset($_GET['subject'])): ?>
<?= 'You chose: ' . $_GET['subject']; ?>
<?php else: ?>
<html>
<body>
<form method="get" action="<?= $_SERVER['PHP_SELF']; ?>">
Choose your favorite subject:
<button type="submit" name="subject" value="fav_HTML">HTML</button>
<button type="submit" name="subject" value="fav_CSS">CSS</button>
</form>
</body>
</html>
<?php endif; ?>
solved Getting a value of button like in this example [closed]