Resources

PHP:
http://www.php.net
This is the official documentation for php, and it’s often very helpful.
http://us2.php.net/manual/en/ref.strings.php
I also recommend this one – it’s great whenever you’re working with strings.
http://www.tizag.com/phpT/
This website has some clear and helpful php tutorials.
http://us3.php.net/manual/en/language.oop5.php
This looks like a great tutorial and/or reference to classes in general and specific to php

DABL:
http://manifestwebdesign.com/developer-resources/database-abstraction-layer/
Documentation for the amazing php 5 database abstraction layer

HTML:
http://en.wikipedia.org/wiki/XHTML
http://www.w3schools.com/tags
http://www.yorku.ca/nmw/multim/html_vs_xhtml.html
http://www.htmldog.com
These are resources for html tags and their properties.

Javascript:
http://www.quirksmode.org/resources.html
Tons of great information about javascript and css
http://www.simpletutorials.com
There is an array of useful little tips here particularly dealing with javascript. (Ignore the aspects regarding useful php opensource code – it’s good, but we will use other tools to acheive that same functionality.)

General:
http://www.w3schools.com
This is a great reference for html, css, javascript, and sql

Projects
note, all projects should work in I.E. AND Firefox!

1) Hello World

  1. php – echo (Note – you should still have and tags in the file when it is sent back to the browser.
  2. Put hello world into a variable and echo it out. Use the . operator to concatenate a “
    ” on the end.
  3. phpinfo()

2) Arrays

  1. Create a php array and display it in a table (ex: first name, last name, address, phone)
  2. Make a 2-d array to create multiple such entries and display it in a table
  3. Use th tags to title the columns with First Name, Last Name, etc.
  4. Use the php “foreach” loop to display them – (you can do a function search on php.net to see how to use this.)
  5. Use inline css to change the look and feel of the table (or just skip this and go to 2.4a – whatever works for you)
  6. Now move that inline up into style tags in the head tags.  Use css classes.
  7. Use javascript (js) to highlight a row upon mouse-over, and unhighlight when mouse-out (Hints: onMouseOver=”“, same with onMouseOut.  Figure out how, in js, to switch style classes of a row.)
  8. Move the javascript into the head tags.

3) Classes and Objects – 1

  1. Create a class for a User of a training application. Include the following private properties:
    • Username
    • Password
    • User Type (Student or Trainer)
    • First Name
    • Last Name
    • Phone number
    • Physical Address (Street, City, State, Zip, Country – feel free to make each it’s own variable)
    • Male or Female
    • Notes – long text field for general notes
  2. Use constants with integer values for each user type.  Make an array of the constants.  Ex. of array:
    public static $UserTypes = array(
    	self::TYPE_STUDENT => "Student",
    	self::TYPE_TRAINER => "Trainer");
    }
  3. Create public methods to retrieve or set the value of each property. Ex:
    public function setUsername($value){
    	$this->Username=$value;
    }
  4. Create a few instances of User objects and put them into an array
  5. Use foreach to output them in a table using columns for each value in 3.1 (Make Physical Address it’s own column – so combine all the variables into one table cell.)
  6. Try leaving some fields in some objects un-initialized.  What happens?
  7. In the User Type cell, Use the string representation of their type rather than just an integer

4) Classes and Objects – 2

  1. Create child classes extending User for each User Type
  2. For Students, include things like Year in School, Major, etc.
  3. For Trainer, include things like YearsTeaching, etc.
  4. Display two different tables – one of students with all their attributes, and one for trainers with all their attributes.

5) Form

  1. Create a form to create a User.  Have the appropriate html form fields for each of the User properties.  Include a submit and reset button.
  2. Upon submitting the form, simply display a page with all the information they input.
  3. Create a link on the information view page that links back to the original form
  4. Change your submit button to an image type
  5. Use js to make the phone text field to only allow phone numbers chars to be typed into it (0-10.s, -’s, and ()’s ) and only numbers into the zip text field compensation type choice changes.
  6. Add labels to your checkboxes so people can click anywhere on the whole label and check the box
  7. Add a “Country” select box (drop down) and use optgroups to separate them by continents or by alphabetical letter (your preference)
  8. Make the “State” dropdown revert to its default (no-state-selected) value and become disabled if a country other than the United States is chosen
  9. Use js to show how many characters have been input into the textarea and to enforce a maximum amount of characters.
  10. Use tabindexes if needed to give a logical tabbing order
  11. Use maxlength to limit field sizes: 255 for most, 14 for phone, etc.
  12. Make your link back to the original form an image link.  Remove any borders the anchor tag tries to add (use css).
  13. Validate fields with js and move all your js out into a separate file
  14. Put each section of the registration into a fieldset with a legend (i.e. username,password = login info; registration type, projects = work info; other stuff = personal info; etc.)
  15. Validate fields with php

6) DATABASE

  1. You should understand the following database terms:
    • Date Type
      • int (and lengths)
      • varchar (and lengths)
      • date, datetime
      • text
    • Primary Key
      • Auto_increment
    • Foreign Key
      • OnDelete
      • OnUpdate
    • Nullable
    • SQL queries
      • Select
        • Join
      • Insert
      • Update
      • Delete
    • Storage Engine (InnoDB, MyIsam)
    • Default values
  2. Create a database to store the values from the User objects.  Use the appropriate data types for each column.
  3. Populate the database with some fake users by typing them in manually (use phpMyAdmin, or software such as navicat, toad, or dreamcoder)
  4. Use a query editor to select Users out of your db based on a given:
    • username
    • lastname
    • first AND last name
    • first OR last name
    • first AND/OR last name starts with (use LIKE)
    • first AND/OR last name contains (use LIKE)
    • List the username and state of users who have a State they are from (NOT NULL) in alphabetical order by that State.  If there are multiple users from the same state, order them by username in reverse alphabetical order
  5. Create a connection with the database from php
  6. Use a select statement to get all users out of the database.  Display them and their basic information in an html table
  7. Use a query editor to insert, update and delete users and their information.
  8. Modify your User form to create/edit rows in the database

7) DABL

  1. Install DABL and replace your handwritten User class and all raw sql and mysql_ functions with DABL code.  See http://manifestwebdesign.com/developer-resources/database-abstraction-layer/ for a link to download and documentation.

(503) 746-9116 | 1925 NW Amberglen Pkwy, Suite 130 | Beaverton, Oregon 97006