Procedural PHP Applications

Forms, Validation, and CSRF Protection

Every form should be treated as untrusted input. This lesson walks through validation rules, input normalization, CSRF tokens, and the POST-redirect-GET pattern.

The result is a form that behaves predictably under normal use and fails safely when the request is malformed.

Edit the panels below and press Run to preview. Nothing you type here is saved — refreshing the page restores the original starter code.

← Previous Next lesson →