Just to complement the answer:
PHP has other variables with similar uses, the $_GET
passes data through the url, the $_POST
passes this "hidden" data (both are deleted when switching pages, for example, if you are on 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 will no longer exist, unless you forward it again) and the $_SESSION
which creates a session with the data that will be saved until deleted (via code) or user exits 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"]
finds the value of the get array at the position that has the example name
To send HTML data to PHP use the tag <form>
specifying how you want to send the data on method
(POST or GET), us input
use the attribute name
to specify the name when picking this value for example:
<form action="pagina/de_destino.php" method="POST">
<input type="text" name="exemplo">
</form>
In PHP use $_GET["exemplo"]
to take the value sent by the user
SESSION needs to be created directly in php, for example:
$_SESSION["exemplo"] = "valor do exemplo";