Just to complement the answer:
PHP has other variables with similar uses, $_GET
passes data through url, $_POST
passes this "hidden" data (both are deleted when you change pages , for example, if you are in ex1.php and pass the data via GET or POST to ex2.php the data will be there, but when going to ex3.php this data did not exist anymore, unless you resend it again) and $_SESSION
that creates a session with data that will be saved until deleted (via code) or user exiting the browser
These variables are global (can be accessed from any part of the site) and array type, so to get a GET, POST or SESSION you must pass a name, for example, $_GET["exemplo"]
looks for the get array value in the position that has the name example
To send HTML data to PHP use the <form>
tag specifying how you want to send the data in method
(POST or GET), in input
use name
attribute to specify name when get this value for example:
<form action="pagina/de_destino.php" method="POST">
<input type="text" name="exemplo">
</form>
In PHP use $_GET["exemplo"]
to get the value sent by the user
SESSION needs to be created directly in php, for example:
$_SESSION["exemplo"] = "valor do exemplo";