← CodePrimer
PHP
Beginner
Forms
Read $_POST values
How do I read POST body fields?
$_POST after form submit.
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$email = trim((string) ($_POST['email'] ?? ''));
}
Notes
Check REQUEST_METHOD before processing.
Keywords: $_POST · post · form
Related
PHP
Embed PHP inside HTML
How do I mix PHP and HTML?
PHP
PHP comments
How do I write comments in PHP?
PHP
PHP variable rules
What are the rules for PHP variables?
PHP
echo vs print
Should I use echo or print?
PHP
PHP scalar data types
What data types does PHP have?
JavaScript
Live input event
How do I react as the user types?