Tutorial

Text file read / write

Read and write a text file function is the basic for text-based programming. Company profile is a good example to start.
The profile consists of the company information needed by the documents across the board. Documents like invoices, purchase orders, and more.

Program flow chart

Webpage generated from the code.

Profile text file.

In text-base database, every text file is a record or data. In the record, the sequence of the text in the lines are the database structure how the program read the file. In this example. the very first line is the company name. All subsequence program has to follow the structure to read the file.

Functions used in this webpage:

PHP

$_POST[] function
trim() function
if statement
fopen() function
fclose() function
fwrite() function
fgets() function
echo function

HTML

HTML Forms

Coding area: