Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Treehouse

Working with $_GET and $_POST in PHP Course (How To)

via Treehouse

Overview

This course will show you how to work with PHP Superglobals such as $_GET and $_POST while using a security-conscious mindset. External inputs, like HTML forms, are considered a security vulnerability so you should always filter inputs and escape outputs. Using PHP Superglobals when using external inputs such as HTML forms, cookies, sessions, and web servers will give you a security-conscious mindset that you can apply to all of your projects.

What you'll learn

  • Build a simple HTML form
  • Use PHP Superglobals when accessing external data
  • echo variables using query strings with $_GET
  • echo variables using without query strings with$_POST
  • Filter inputs with filter_input() for various input types
  • Escape outputs with htmlentities(), htmlspecialchars(), and strip_tags()
  • Develop a security-conscious mindset for all of your projects

Syllabus

$_GET and $_POST

Superglobals can be used globally without typing global $variable; which means they are available inside of functions or methods by default.

Chevron 6 steps
  • instruction

    Introducing Superglobals $_GET and $_POST

  • instruction

    Working with $_GET Values

  • instruction

    Using $_GET variables in a Function

  • instruction

    Working with $_POST Values

  • instruction

    Choosing Between $_GET and $_POST

  • Quiz 1

    5 questions

Filtering Inputs and Escaping Outputs

Inputs from contact forms and any external inputs in general should be considered a security vulnerability and should not be trusted to be what you might expect.

Chevron 3 steps
  • instruction

    Always Filter Inputs

  • instruction

    Always Escape Outputs

  • Quiz 2

    5 questions

Reviews

Start your review of Working with $_GET and $_POST in PHP Course (How To)

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.