PHP is a powerful way to add interactivity to HTML webpages.
In PHP programming we can output to the webpage using the echo command...
The PHP command echo ("Hello World");
will produce this: Hello World
...but without any processing or interactivity that isn't any different from static HTML.
PHP gets really useful when we need to process data from users or perform other dynamic tricks.
I think my first love of PHP came from wanting to build web pages without
having to put the same footer information in every page... More about includes later.
There are two basic ways to send form data through PHP. There is the GET method
which passes the data through the URL string. It can be nice for simple queries
and it allows the user to bookmark the results like: www.mysite.com/?categories='tech'.
So, good for simple stuff but not secure at all.
The preferred method for sending variables in plain old PHP is through the HTTP POST method.
The data is invisible and you can send more of it.
Here's a form where I ask you to submit something, I POST it to this page and then I echo it back in a variable called output: