Code
PHP is a language for web pages that run on the server. The browser asks for result.php. The server runs PHP, talks to a database if needed, and sends HTML back. You do not write PHP for the browser to compile like Java. You write a .php file the server executes.
Smallest file: <?php echo 'Hello PHP'; ?> Save as hello.php under the web root (htdocs in XAMPP). Open http://localhost/hello.php. If you see Hello PHP, install is working. If you see the source, Apache/PHP is not running or you opened the file as file://.
Variables start with $. $marks = 72; echo $marks; Strings in quotes. Every statement ends with ; . Forms send data to PHP as $_GET or $_POST. That is how login and result pages work.
Trap: calling PHP a database. MySQL is the database. PHP is the language that talks to it. Trap: using the old mysql_ functions — use mysqli or PDO with prepared statements.
Browser
│ GET /hello.php
▼
PHP on the server
│ echo
▼
HTML back to browserServer language. echo Hello. $marks. PHP is not the database.