
Module 2 built upon our learning of HTML and CSS by teaching us PHP, or Hypertext Preprocessor. PHP is a server-side scripting language that allows us to add logic to the webpage content. This is important, because it allows us to modify HTML elements dynamically, rather than have to modify the html of the website constantly. Because PHP is serverside, it also helps to hide information used in calculations that the user does not need to see.
While the W3Schools and Codecademy tutorials were helpful for me, I enjoyed working from Larry Ullman's PHP and MySQL textbook. The PHP textbook provided its own introduction and tutorial for learning PHP by combining different PHP scripts with HTML forms that I learned how to create previously. The textbook projects were more difficult than those provided in Codecademy, which I feel gave me knowledge that was more useful for developing complicated, interesting internet applications in the future.
For this assignment, I summarized each of the first 3 chapters of the book and included scripts that I created from following the tutorials in the book.
Chapter 1Chapter 1 provided a review of the fundamentals of PHP, such as syntax, variables, concatenation, functions, and constructs. Included from the chapter is the simple numbers.php script, which calculates the total cost of an order of 30 widgets, based on the unit price of $119.95 and tax rate of 5%. | numbers.php script |
Chapter 2Chapter 2 moved on from fundamentals to more programming concepts such as arrays, conditionals, loops, and operators. This chapter taught me how to apply those concepts to create HTML forms that use PHP to generate responses based on the user's form input. Included from the chapter is a simple HTML form that uses PHP to generate a response based on the user's name, gender, and email address. | form.html script |
Chapter 3In Chapter 3, I learned how to include multiple files in a PHP script and advanced form handling. Included from the chapter is a calculator script that includes a header and footer file. The calculator determines the estimated cost and time of a trip based on gas prices, length of the trip, and fuel efficiency of the car. | calculator.php script |