Inline Style
inline-style.htm
Source Code
A basic HTML page with no style or styles.
Document-level Style
documentlevel-style.htm
Source Code
A basic HTML page with no style or styles.
External Style
external-style.htm
Source Code
A basic HTML page with no style or styles.
Login1 Example / HTML Only
login1.htm
Source Code
HTML template for a simple login form (username and password).
Login1
login1.php
Source Code
A login form that reads the username and password, then
displays them on a separate display form.
EntryForm
entry-form.php
Source Code
A login form that reads the username and password, then
displays them on a separate display form.
EntryFormGet
entry-form-get.php
Source Code
A login form that reads the username and password, then
displays them on a separate display form. Use the HTTP method GET,
which passes information back to the server in the URL.
Voting Machine1
voting-machine1.php
Source Code
Server Variables
server-variables.php
Source Code
Consultant BS Generator
consultant-bs-generator.php
Source Code
Color Table
color-table.php
Source Code
Lightweight Graph
light-weight-graph.php
Source Code
Phonebook5
phonebook5.php
Source Code
Phonebook6
phonebook6.php
Source Code
Submit Counter
submit-counter.php
Source Code
Add to Dropdownmenu
add-to-dropdownmenu.php
Source Code
Votes Summary
total-votes.php
Source Code
Test Write3
test-write3.php
Source Code
Phonebook7
phonebook7.php
Source Code
Groceries Display
groceries-display.php
Source Code
Groceries OnSale
groceries-onsale.php
Source Code
Groceries By Code
groceries-by-code.php
Source Code
Validation2
validation2.php
Source Code
Date Format
date-format.php
Source Code
Guestbook
guestbook-home.htm
Source Code
Redirect
redirect.php
Source Code
Read grocery data from GroceryList table in
groceries.mdb database and display data in an HTML table.
PHP File Access Examples
Raven1
raven1.php
Source Code
Use the function file_get_contents to read the entire file and store
the return value in a string. Then display this string on the formatted
document using pre tags.
Record votes and print results to an output file. View the file at this
link:
http://ectweb.cs.depaul.edu/sjost/Database/votes.txt. After you
append data with the Voting Machine example, refresh the
browser displaying the output file to see the new data.PHP Language Examples
Greeter3
greeter3.php
Source Code
The user enters a name in a testbox. A greeting is displayed
using this submitted name.
The user enters a name in a testbox. A greeting is displayed
using this submitted name.
Each time the form is submitted, a random sentence is composed consisting
of a random verb, adjective and noun. This sentence is then displayed
in a textbox.
A table with dynamically generated background colors is produced.
The background colors are mixtures of various intensities of
red and green.
A dynamically generated table within a table is used to create
a simple or "lightweight" bar graph.
The user enters a name. When the form is submitted,
a new form is shown with the phone number.
Same as the Phonebook5 Example, but using only one form.
Display how many times a form has been submitted for the currently
running browser. Use a session variable to keep track of this.
The user types a word in to a textbox and submits the form.
The word is then dynamically added to the dropdownmenu.
A session variable is used to keep track of this.More PHP File Access Examples
Raven2
raven2.php
Source Code
Use the fopen and fwrite functions to read a file one line at a time.
Here is the raw votes data:
votes.txt
Append data to a file using the fwrite function.
View the file at this
link:
http://ectweb.cs.depaul.edu/sjost/Database/test.txt. After you
append data with the Test Write3 example, refresh the
browser displaying the output file to see the new data.
Same as the Phonebook6 Example, but the names and phonenumbers
are read from the input file
phonenumbers.txt. Also, the server variable
$_SERVER['PHP_SELF'] is used to refer to the current page.
Read grocery data from
groceries.txt and display it in a HTML table.
Read grocery data from
groceries.txt and display it in a HTML table. Display all items,
onsale items, or items not onsale depending on which checkbox is
checked.
Read grocery data from
groceries.txt and display it in a HTML table.PHP Validation Examples
Validation1
validation1.php
Source Code
When form is submitted, validate name, gender and age. If errors
are found, display appropriate error messages.
When form is submitted, validate SSN. If an error
is found, display appropriate error message.PHP Miscellaneous Examples
Phonebook8
phonebook8.php
Source Code
Same as the Phonebook7 Example, except that no array is used.
Display the name in the dropdown menu and use the phonenumber as the
value of the dropdown menu. The names and numbers are obtained
from the file
phonenumbers.txt.
Display parts of date and time according to the PHP
date function format strings.
Write to and read an online guestbook.
Redirect to one of the pages
donald-page.php,
mickey-page.php or
tweety-page.php using the header command.PHP Database Examples
Groceries Display2
groceries-display2.php
Source Code
The database is at
e:\ectserver\sjost\Database\groceries.mdb.