Services Work Learn About Contact
0/8
Lesson 7 of 8

Forms & Superglobals

PHP collects form data through superglobals: $_GET (URL parameters), $_POST (form submissions), and $_REQUEST (both). Always validate and sanitize user input.

PHP
<?php
// form.php sends data via POST
$name = $_POST["name"] ?? "";
$email = $_POST["email"] ?? "";

// Sanitize
$safeName = htmlspecialchars($name);
?>

<!-- HTML form -->
<form method="POST" action="process.php">
  <input type="text" name="name">
  <button type="submit">Send</button>
</form>
🧠

Quick Quiz

Answer correctly to unlock the next lesson.

Support the mission

This learning platform is 100% free: no ads, no tracking, no paywalls. If it helped you learn something useful, you can support future lessons or donate to Doctors Without Borders, which provides emergency medical care in crisis zones worldwide.

🎉

You completed PHP!

You finished all 8 lessons and quizzes. You now know the basics of PHP.