How can you pass a variable without using a form in PHP?
To pass a variable without using a form in PHP, you can use query parameters in the URL. This involves appending the variable and its value to the URL of the destination page. The destination page can then retrieve the variable from the URL using the $_GET superglobal.
// Source page
$variable = "example";
header("Location: destination.php?var=" . $variable);
// Destination page (destination.php)
$passed_variable = $_GET['var'];
echo $passed_variable; // Output: example