Post

PHP Course for Beginners (Dani Krossing - Course Notes)

PHP Course for Beginners (Dani Krossing - Course Notes)

These are notes from the “PHP Course for Beginners”

6. Basics of PHP form Handling

  • link
  • check that method is POST by using the superglobal $_SERVER["REQUEST METHOD"] == "POST"
  • every time you grab data from a user, make sure to use the htmlspecialchars function to sanitize user data
  • send the user back to the front page with a header: header(“Location: ../index.php”);
  • the exit() function in PHP to quit the execution of a script (like exit in bash)

7. PHP operators

  • basically what you’d expect, except string concatenation is done with . not +
  • The assignment operator is = and the comparison operator is ==
  • Just like JavaScript it has the weak comparison (==) and a strong comparison operator (===)
  • != can also be written <>
This post is licensed under CC BY 4.0 by the author.