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”

method:”post”>

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s