Week 7 Reading File Writing File

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 17

Week 7

Reading and Writing File

Prepared by:

Ryan B. Azur
PHP
Key Skills and Concepts
Learn how to read data from files
Learn how to write or append files and to understand the
situations where to use it
Be able to display data from other external file in the form
Reading a File
Reading from a text file
Reading a File
Reading from a text file
$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];

$_SERVER – It is a global variable. It is an array containing


information such as headers, paths, and script locations. The
entries in this array are created by the web server.

$_SERVER['DOCUMENT_ROOT'] - The document root


directory under which the current script is executing, as defined
in the server's configuration file.
Reading a File
Reading from a text file
Writing a File
Writing to a text file – Overwrite (html file)
Writing a File
Writing to a text file – Overwrite (php file)
Writing a File
Writing to a text file – Overwrite (php file)
Writing a File
Writing to a text file – Append (php file)
Writing a File
Writing to a text file – Append (php file)
Displaying a Data
Displaying Data in a Table – html file
Displaying a Data
Displaying Data in a Table – php file
Displaying a Data
Displaying Data in a Table – php file
Displaying a Data
Displaying Data in a Table – php file
Displaying a Data
Displaying Data in a Table – php file
Displaying a Data
Displaying Data in a Table – php file
Lab Project 3
Continuation of our Laboratory Project
Prepare your previous 2 laboratory projects
Lab Project 1:
azur_1.html – should be the initial form
azur_1.php – after clicking the submit button, the information should be
displayed in this page
Lab Project 2:
azur_2.html – should be the form wherein the user can submit the
information and the mortgage calculator should be also located on the
right side. Make use of the div. Css and the images should be located in
separate folder
azur_2_thank_you.php – should be the thank you message (originally
this should be your azur1.php)
azur_2_mortgage.php – this is where the computation for the monthly
payment should be displayed. Amount and the interest rate should be
validated if it is a valid entry

You might also like