Ch3 PHP and MySQL for Dynamic Web Sites

Right off the bat the book states there will be three last things to focus on while using php to make websites dynamic;

  1. Using multiple files
  2. Forms (again)
  3. Functions

After this chapter the book will move on to MySQL.

So I wasn’t sure what the book meant by “using multiple files” but when I started reading I got really excited! I had done this in a project for my responsive web development class (well I was the overly-enthusiastic/involved “lead designer”) so I already understood how to do it. Using include and require (and there “_once” additions when needed) you import other html files; often these are footers, headers, or sidebars that are common across many pages. This practice is more secure, easier, and  quite frankly bad ass. I’m excited for class to start up so I can use this!

The reason forms were covered again is because the previous method the book taught involved having one webpage display the form and another handle it, now the book wants to show how to have one singular page do it. This is accomplished buy using a simple if else statement…

if (@_SERVER [“REQUEST_METHOD] == “post” {

//handle form

}else {

//display form


Sticky forms were also covered, these are forms that retain the info that has been entered into them after the fact. This is done by simply having a php section within each form element that has an isset checking for a filled form and a resulting echo with the value of the forms section given every thing checked out. I will definitely use this…and furthermore have a function to make is easier! To address functions out of courtesy, they were covered here but were nothing crazy or new.




Ch2 PHP and MySQL for Dynamic Web Sites

Almost a week after reading this I’m here with the review, I have been preoccupied with Christmas and working in my house so I cut my self a well earned break. The main focus of this chapter was handling forms. The two most notable things I took away were how switch statements are used and that there actually is a way to handle php externally instead of putting it in your html markup(though both ways work and have there own place in different situations). A php file can simply be made and put in the same file as a html file and it can simply find and handle all information in that area! The term super-global was tossed around and I think it pertains to this concept; which makes since given what I know about global and not global elements in code. So for example I could build a form and in the opening form tag I could give an action and method like so…

<form action: “handle-form.php”


The “handle-form.php” could have actions “echoing” the inputs from said form AND upon submission create a nice webpage to display everything named “handle-form.php”. Awesome!

Now the switch statements, I had already learned to work these in code academy but had noted that I needed to lean more, I just didn’t quite understand what I was doing. I knew that switch statements were meant to me the “syntactic sugar” version of ifelse statements but that’s about it. Turns out I was over thinking them! With in  switch and endswitch you simply have many cases with values; and if these values are met then the following code is executed up until the break. This is cool; I have been seeing a lot of things in php that I want in JS and plan on looking for.

I should also note some other things I learned, like getting a handle to things using $-REQUEST[“name”], how to actually use +=, how to use isset() and empty() in validation, and finaly how to work arrays in php; which is dream given the availability of foreach() and adding elements through simply stating where you want it. The chapter also touched on other things like while loops but I have little input to give about it; there was not much takeaway for me here.

Ch1/intro PHP and MySQL for Dynamic Web Sites

Knocked that one out! Woohoo, I’m excited for php, and have gained a lot on much wanted/needed info regarding it. First off I would like to say that I had asked my JavaScript teacher how php in integrated before we went on break and he responded, “they go in php tags like JS goes in script tags”. Of course I went on to hit with a barrage of questions following that statement, the first and foremost being, “can/will I link an external php file?!?!?!”. His response was almost non existent… probably because he knew that it would keep me up at night thinking which would eventually lead to studying and blogging. Well here is the answer (currently) php is ran server side and consists in your html like any other tag right where it needs to be, when your site is pulled up the php has done its job and is now (in most cases) html markup. I also had been wondering a few more things like why use php over JavaScript, is php like other languages I know, and is php going to allow me to make log in’s? Well first off I discovered many good reasons to use php over JavaScript, the best reason being that its run server side, this means you rely less on the clients setup and more on your own while simultaneously boosting privacy. I also discovered that I will be able to create user accounts and log in’s with php; furthermore I wont have too hard of a time doing so it seems because php is very much like other languages I have learned. I was amped to see how php was written! First of all php is , like I stated before, put in a tag… a pelf closing tag of sorts.


OK easy enough. In context this would be somewhere in the body of your html markup and the actual content would go where I put “content goes here” in the following example…

<?php “content goes here”;?>

Notice the ; which much like other languages runs the function.


In the first chapter alone I have gained the ability to…

  • Utilize the php tag properly
  • Make comments (but sublime has my back anyways)
  • Set variables using $
  • Use strings and concatenate them using .
  • Handle numbers and operates such as round()
  • Use constants using define (CONSTANT,value)
  • How to “properly use ‘single’ and /”double/” quotations” 

I also learned that I need to use .php over .html when using php like this, and also learned a bit about debugging. I found something interesting too, it sounds like I have to run my site on a server and not local for php to work, I will worry more about that come class time though given the fact I can learn seamlessly on codecademy.


define (FEELING, ‘Happy’)

?reason = ‘I finished my chapter one’

echo “<p>”I am feeling ‘ . FEELING . ‘ because ?reason !</p>