If you've followed the instructions at the Chicken Smoothie basic HTML adoptables tutorial, you'll end up with a website where people can get adoption codes for pets. You will manually "age" the pets by replacing the image file on your server with an older picture, which will make everyone's pet grow up at the same time.
This way of making adoptables works fine, and is a great way to start off. But you can do better by using a PHP-based system like Chicken Smoothie uses. In this tutorial you will build an adoptables system using PHP which has some of the features of Chicken Smoothie's adoptable system. I'll only use free tools and show you how to do everything step by step.
Before you start this tutorial, you should have a firm grasp of HTML. Ideally, you will have already built and used the basic HTML adoptables system.
The first step in building a website which uses PHP is finding a web host which lets you use PHP. 000webhost is worth a look. Freewebs does not support PHP at all.
You can check whether your server supports PHP by making a PHP page which tests out some PHP features. A PHP page is just a HTML page with some extra PHP code in it. For example, this is an HTML page:
<html> <head> </head> <body> <h1>Hello there!</h1> </body>
Instead of writing the message "Hello there!" into the HTML code, you could get PHP to write it instead. Writing PHP code is easier in a program which colours the code for you to make it easier to read (called "syntax highlighting"). One program which does this is Dreamweaver (it also lets you edit webpages visually instead of writing HTML code), but Dreamweaver is not free. A free alternative is "Notepad++", and that's what I'll be using in the tutorials. Notepad++ uses syntax highlighting, and understands how to edit HTML and PHP pages, but it does not have a visual editor (so to see how your page looks you need to view it in a web browser).
Download and install Notepad++. Open Notepad++ up, and click File->New to create a new empty document. Click File->Save as, and save your new document as "hello.php". This will be your first PHP page. Copy and paste this code into the new document and save it:
<html>
<head>
</head>
<body>
<h1><?php echo "Hello there!"; ?></h1>
</body>
Everything inside the "<?php" and "?>" tags is PHP code. Your visitors don't see the PHP code when they view the page, they just see whatever the PHP code chooses to print out into the HTML code. Here, we're using the "echo" command to print out the text "Hello there!" inside the h1 tags. If you view the page on a server which supports PHP, you'll see:
You can see it working on our server. Your computer itself doesn't know how to run PHP code, so you'll need to put it on a web host which does to be able to see the PHP working. If your server doesn't support PHP, you'll just see the PHP code itself being displayed:
I'm not going to go much further into the basics of PHP. Now that you are able to run PHP code, you should read a PHP tutorial like the one at W3Schools to find out more about the basics of PHP in their PHP tutorial.
You can continue with Part 2 of the tutorial, or discuss this part of the tutorial in the forums.