DIY : Creating an HTML body in a PHP file – Creating a PHP blog (without a framework) – Medium

Now we’re going to open up our text editor/IDE and write down some real HTML. I want you to open the file you used in the last tutorial and delete the PHP code inside of it, and replace it with the following:

Yeah, I was getting dusted in Fortnite before I started this tutorial.

Now if you save that, open up your browser to localhost/tutorial.php you will see the added exclamation point in there! We’ve just accomplished the same thing using two different technologies, congratulations!

Now, the above syntax would not be the correct way to format an HTML document, however we are not creating an HTML document, this is a PHP document as signified by “.php”. A great way to learn HTML is to head over to Codecademy (that link is subject to change), if this is completely unfamiliar to you, they will teach you everything you need to know about HTML.

From here on out you will basically be copying what I’m doing, make sure you are doing everything I am putting up or you will be very frustrated.

Here we are setting up a very simple, very 90’s navigation area with two very simple links:

Can’t see Fortnite anymore.

Which should produce this:

4/29 blaze it

What the HTML is doing is saying okay, there is no meta-information in this file so let’s move on to the body, oh there’s lots of stuff there! The hashtags that are in there basically signify that when you click on the link, nothing is going to happen, you’ll see how that changes soon.

We are basically done, I just want you to do one more thing. We’re going to create two new files. The files are: createpost.php, viewpost.php, and blog.php. No.. I said three, not two. You’re bonkers.

That’s a wrap, thank you so much for checking out this tutorial, it’s much appreciated. Please leave a comment and tell me if I helped at all, if the formatting was terrible, if I should stop trying to be funny. I really just want to help people learn, and save you all some time. Thanks again, cheers.


Please enter your comment!
Please enter your name here