PHP is a backend (server-side) programming language that can be put inside a HTML document or separately (but still displays as a webpage). PHP is often used in webpages for storing user data, submitting and validating forms and web applications.
See the below links for learning about PHP:
The ?var=val bit in the URL is to pass a variable from a HTML file to a PHP script. To put more than one variable in the URL you can separate them with ampersands, leading to a URL similar to http://example.com.php?var1=val&var2=val