I need some help about how to pass a variable with POST without using sessions.
Currently my code doesn't display value of the variable called $myvariable:
<?php
if(isset($_POST['testbutton'])){
if ($_POST['testbutton'] == 'Testing') {
echo $myvariable;
var_dump($_POST);
}
}
$myvariable = "hello world";
echo '<form action="'.htmlspecialchars($_SERVER["PHP_SELF"]).'" method="post">';
echo '<input type="submit" value="Testing" name="testbutton"/>';
echo '</form>';
?>
What should I change in the code to be able to use $variable in POST['testbutton'] part of the code ?