Introduction
PHP runs on the server and outputs HTML to the client. Start by installing a local server (XAMPP/WAMP) and save files as .php
.
<?php
echo "Hello from PHP!";
?>
Working with forms
<form method="POST">
<input name="name">
<button>Send</button>
</form>
<?php
if($_SERVER['REQUEST_METHOD']==='POST'){
echo "Hi " . htmlspecialchars($_POST['name']);
}
?>