PHP Practice - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

PHP Practice

Description:

Print the letters from A to Z using any kind of loop ... their favorite color from a select control, then make a page that prints their ... – PowerPoint PPT presentation

Number of Views:63
Avg rating:3.0/5.0
Slides: 14
Provided by: sit4
Category:
Tags: php | coloring | pages | practice | print | to

less

Transcript and Presenter's Notes

Title: PHP Practice


1
PHP Practice
  • SI 539
  • Fall 2004
  • Prof. Sandra Bartlett

2
Put it all together
  • Write a web page on projects that creates a form
    control from your database type table and lets
    the user choose a type to see. Format the results
    in a table. Have an external CSS that makes the
    background of the table one color and the table
    itself a different color. The page should be well
    designed. Use good style.

3
String functions
  • Assign to a variable a string describing your
    favorite web site. Print the following
    information from the string
  • String length
  • First occurence of the string "like"
  • The string encrypted
  • The string reversed
  • Find the last occurence of the letter s
  • Make the string all lower case
  • Replace all occurances of "an" with "AN"
  • Make every word start with uppercase
  • Break the string into separate words

4
Creating controls from a database
  • Make a form with a drop down menu containing the
    types from your lab database
  • Make a form with a set of radio buttons
    containing the types from your lab database

5
Validation functions
  • Write a form with a text control and check the
    input for each of the following types of data
  • Zip code
  • Phone number
  • Email address
  • Plain text
  • (output like invalid zip code, valid phone,
    invalid email, valid text)

6
Header / Footer
  • Write a header
  • Write a footer
  • Include them in 2 web pages

7
Authentication
  • Write code to authenticate a user using a custom
    form
  • Write code to authenticate a user using the
    browser's built-in form

8
Using echo and print
  • print your name 3 times in 3 different colors.
  • echo your name 3 times in 3 different font sizes.
  • Show 3 different random numbers

9
Using if
  • Generate a random number and tell if it is
    greater than, less than, or equal to 44
  • Generate a random number and tell if it is odd or
    even. (Do it using / and do it using )

10
Using loops
  • Print the numbers from 10-30 inclusive using
  • while
  • for
  • do
  • Print the letters from A to Z using any kind of
    loop
  • Print the multiplication tables from 0 to 12
    using one loop inside another

11
Using arrays
  • Make a numbered array of your favorite movies and
    print them out
  • Make an associative array using SI course numbers
    as the key and course titles as the value
    ("SI539" - "Design of Complex Web Sites") and
    print out the key/value pairs (use foreach)

12
PHP and Forms
  • Make a form with 2 different controls and a
    submit button. Write a form handler that prints
    the values of the controls when the user clicks
    submit. (use foreach)
  • If you did the first one right, you can add
    several other controls to the form and get the
    correct output without changing the form handler.
  • Let the user enter their name in a text field and
    choose their favorite color from a select
    control, then make a page that prints their name
    in their favorite color

13
PHP and Database
  • Do the lab for Oct 12/14 over using a different
    form control
  • Do the lab for Oct 12/14 over so the user will
    see values from the other table if they choose
    the column with the foreign key
  • Do the lab for Oct 12/14 over so the user can
    choose more than 1 column to view
Write a Comment
User Comments (0)
About PowerShow.com