Sunday, September 13, 2009

Exercise 5

This exercise examines some environment variables on the server. I did this exercise on a windows machine using the $_SERVER[variable] and got these results:
  • $_SERVER[$REMOTE_ADDR] - You are connected from: 127.0.0.1

  • $_SERVER[$PHP_SELF] - You are connected from: 127.0.0.1

The second exercise creates a variable, $myvar, and assigns it a value, Hello World!. The echo function is then used to display the variable, Hello World!, on the screen for the user.




The third exercise creates a form to enter your name which uses the "Return" key to submit the text. The result was:




The fourth exercise builds a php file that uses the input from the last exercise and prints it on the screen for the user. Although I did not get the desired result, from purely ready the code I could see what the outcome was supposed to be.



For the fifth exercise I could create the database and tables, no worries. Using the database commands:

CREATE DATABASE mydatabase;

USE mydatabase;

CREATE TABLE employees

(First varchar(20) NOT NULL,

Last varchar(20) NOT NULL,

Address varchar(50) NOT NULL,

Position varchar(20) NOT NULL);

The rest of exercise five is where I had trouble and run out of time to complete. Hopefully have a bit of time towards the end of semester to fix it up.

No comments:

Post a Comment