The next website we look at will just use HTML and PHP. We can add CSS and JS later. They’re not required for this website to work. I’m trying to demonstrate how many of these tools can be used in isolation.
Developing and deploying an HTML and PHP website is more complicated than developing and deploying a static website. That’s because we’re using a dynamic tool called PHP. This tool makes our website dynamic. With this tool, we can now get data from our visitors and save it somewhere. There was no way to permanently save data using the static tools. Now, we can put a contact form on our website. A static website cannot have a contact form. We could also create a calendar and let users save events to it. However, our ability to save data is severely limited right now.
PHP is a tool that runs on a server. This tool can only run on the server. It’s not like the static tools (HTML, CSS, JS) that can run directly in your browser. In other words, PHP is not a program that runs on your computer; whereas the static tools all run on your computer (sort of). The static tools run in the browser (which runs on your computer). The dynamic tools (like PHP) run on the server (not your computer).
To develop an HTML/PHP website, you’d need to install PHP and a web server on your computer, but that’s just to develop it locally. You’d also need to install other tools to help your web server work with PHP files instead of plain HTML files. The web server (NginX or Apache, for example) was able to easily deliver your HTML file, but it needs to run your PHP file before it can deliver it.
Now, let’s go back to the reason we’re severely limited as far as saving data goes. We have an HTML form that receives text from the user and sends it to our server when it’s submitted. PHP can take this data and permanently save it somewhere, like a CSV file. We’d end up with a fairly large CSV file containing contact form submissions. That’s fine, but there’s a much better way to permanently save data. It’s called a database. Don’t forget that it wasn’t possible to permanently save data with a static website. With PHP, our website is now dynamic, and we can permanently save data, albeit clunkily.