What is the best method to pass a value from one PHP page to another when a button is clicked?

When a button is clicked on one PHP page and you want to pass a value to another PHP page, you can use either GET or POST methods to send the value as a parameter in the URL or in the form data. Using GET method will append the value to the URL, making it visible to users, while using POST method will keep the value hidden in the form data.

// Page 1: Sending page with button
<form action="page2.php" method="get">
    <input type="hidden" name="value" value="example_value">
    <button type="submit">Send Value</button>
</form>
```

```php
// Page 2: Receiving page
if(isset($_GET['value'])){
    $received_value = $_GET['value'];
    echo "Received value: " . $received_value;
}