The trick shows communication between two modules without using any database or file system.
You can download the full code here and study it.
The short explanation
The form sends via POST method data into itself and stores variables into $_SESSION global variables.
The output just reads $_SESSION relevant variables and shows them.
On the left you can see both modules before an item selection and the form submission.
On the right you can see both modules after the form is submitted.
It is very easy to rewrite the logic of the code to your actual needs.