This is more of an "understanding" question that a specific example. I'm coming from a Python/R/Scientific Computing background where I usually compile things or communicate through an interpreter. But everything is typically on the machine so there's no "communication" between server/client.
I'm now trying to learn PHP (in the hopes of letting users run my scripts from a web interface) and am curious what happens during a POST.
Consider the following script:
<!DOCTYPE html>
<html>
<head>
<title>Form Testing</title>
<meta charset="utf-8"/>
</head>
<body>
<?php
if($_POST['formSubmit'] == "Submit") {
echo "Post Status is: ".$_POST['formSubmit']."
";
$varMovie = $_GET['formMovie'];
echo "Your Favorite Movie Was: ".$varMovie;
}else{
echo "Post Status is: ".$_GET['formSubmit'] ."
";
}
?>
<form action="index.php" method="post">
Which is your favorite movie?
<input type="text" name="formMovie" maxlength="50">
<input type="submit" name="formSubmit" value="Submit">
</form>
</body>
</html>
I get that the Submit button sends the equivalent of python dictionary (associative array?) to the next page. Then the command $_POST['formSubmit'] pulls up the value.
But where is the value in between when I hit the submit button to when the page loads. In other words, after the sumbit button, what actually happens? Clearly, the page must create this associative array somewhere and pass it somehow but I'm not sure how it does it.
The idea with a get seems more clear. The URL is appended so the PHP engine can read the URL string and find the values of all the variables (I'm assuming that's what happens yes)?
Thank you for your help!