DEV Community

Cover image for 001 Head First PHP & MySQL Summary Chapter 1 Part 1
ramank-r
ramank-r

Posted on

001 Head First PHP & MySQL Summary Chapter 1 Part 1

Hello People, Welcome to this series, where I upload summary of the book Head First PHP & MySQL, as I learn, so it can be useful for you all.
I try to cover important points.

Summary of Chapter 1 - Intro, Part 1

1.
HTML and CSS are used to design static web pages. A visitor to the web page designed by HTML and CSS probably can't do anything rather than simply looking at the information thrown up at the screen. ( Although, with the use of Google Forms, 123Forms, JotForms etc. we can take input but hey, they use javascript and possibly much complex systems, we don't know (at least me). )

2.
HTML and CSS will fail to send a mail or searching a database.

3.
What happens when a visitor opens a web page?
i. Web Browser requests for a page which the visitor wants to access.
ii. The requests gets passed to Web Server which says? W.H.A.T Y.O.U. W.A.N.T N.O.W. H.A.U.G.H.T.Y. Y.O.U.N.G. M.A.N.? _Oh? A simple HTML and CSS page named "index.html"? _
Hmm.. Let me see, Oh yeah! I have it stored. Take it!
iii. Visitor enjoys his dull and boring web page.

4.
Our Hero comes here! PHP!
PHP gives us the power to manipulate that "index.html" (which was stored at the web server) just before it is being sent to the web browser. A PHP Script will run on the server and can create custom new HTML files to be delivered to client.
The browser will see that it is receiving a HTML File. (But we will know that it was created using PHP). PHP stores and uses data stored from databases and uses it to generate HTML pages.

5.
We then see that trying to take input from HTML and CSS, we fail miserably.
But if we use PHP then there is some hope. We instruct that pass the entered data to PHP using "action".
<form action="welcome_get.php" method="get">
This means web server knows it has to process the "welcome_get.php" file.

6.
We can instruct the PHP Script to
i. Send confirmation page to client (i.e. Generating a new web page in HTML CSS), informing, we have recieved the entered data and
ii. Perform some operation on the entered user data like, sending a mail to entered address.

7.
Every PHP Script ultimately gets turned into HTML & CSS once it has finished running on the server. Browser will see that I am opening a PHP file but its contents will be PURELY in HTML & CSS.

8.
To actually see working of PHP and HTML, we have to setup PHP development environment.
We can use a local host (safe for development) or online server.

  1. I set up Apache Local Host, and PHP 7 using these videos on Windows 10. i. Apache - https://www.youtube.com/watch?v=oJnCEqeAsUk

ii. PHP -
https://www.youtube.com/watch?v=VwObm3qvS3Q

  1. Uploading files to a web server requires the help of a utility, such as FTP, FILE TRANSFER PROTOCOL.

NOTES:

  1. PHP used to stand for Personal Home Pages, but now is used for Hypertext PreProcessor.
  2. .HTML, .CSS, .PHP all files are stored on the Web Server, but it processes (modifies), only .PHP Files.

Thank you.

Written on 17 Feb, 2022

Top comments (0)