Simple PHP Example

This is a php page that displays a random number. When the form submits to itself php code displays the number.

Notice the page reloads. When the form is submitted the request is made to the server to the page identified in the action attribute of the form. In this case it is itself. The page is then sent back to the browser after processing, displaying the number.