Introduction
For my first installment of this series, I would like to start by going over exactly what PHP is and how it operates. Most of the time you need to have a firm understanding of how something works before you jump in and start tearing out insides, right? Okay, maybe not, but I'm a careful person. I like knowing what exactly it is I'm getting into. This 'episode' of the series will go through what PHP is and how it works in coalition with a MySQL server. I'm not a very artsy fartsy type, but if you happen to be a visual learner and request graphics to me I'll do my best to photoshop some decent references.
PHP: What is it?
The 'PHP' acronym originally stood for Personal Home Pages. However, somewhere along the course of time the meaning was changed to mean PHP Hypertext Processor. Its redundant, I know. I jest, but PHP is not a language to be poked at frequently with fun. PHP is a powerful language that creates interactive web applications instead of boring, static HTML pages that can only display information. The code runs on your web server and is stored in PHP scripts that usually hold a .php file extension tagged to the end. Essentially, the entire purpose of PHP is to make HTML pages more dynamic.
Okay, so how does it work?
The client's web browser (your web browser) requests an HTML page from a web server somewhere on the 'net. Essentially, for the less computer savvy, it is what you're doing whenever you type an address into the address bar. Example: http://www.example.com/example.html. The web server finds and returns the file your browser requested. In this case example.html. Once your browser displays the page, you will more than likely fill out a form of sorts. I'll go more into what exactly forms are later. Once you hit the submit button on the page, a couple of different things go down. First of all, depending on the scenario, the HTML page is sent from the web server to the client. After, the PHP code within the web server alters the HTML code as needed. In my example I'm going to demonstrate, I will have the web server send myself an email with the data you inserted into the form. (More on this later.) Then, a conformation HTML file will also be sent back to the client's browser.
Quick Question: Did you just insinuate that PHP files contain HTML?
Absolutely. PHP Files on the client's side contain no actual PHP code. There may be some exceptions to this, but I haven't run across any as of yet. This all ties in with the important fact that PHP is a server-side language. No clients involved!
Forms
The form tag along with the action element allows you to point your HTML page's submit button to a certain PHP script on your web server. An example would look like: /form action = "example.php" method = "post"/
The action attribute of the form is what causes the PHP script to run on the server when the form is submitted.
Outro
So what did you think? Good? Bad? Meh...? This is a very slow start, I know. I'm taking things in very small increments over a large period of time on purpose. There will be more to come depending on how you