Lab 5 Assignment
In
order to earn credit for Lab 5, please read the following instructions
and complete the questions below. To minimize confusion,
instructions and questions are in one numbered list. So when you answer
the questions, number your answers according to the questions.
For instance, your first answer will be to point #3 below.
Points #1 and #2 are instructions, not questions. I have
emphasized the questions to be answered in bold.
- The
zip file Lab5-assignment-deleteDepartment is an extension of the
application presented in Lab 5. Unzip the folder into your Lab5
(or Lab5-student) folder.
- The folder contains 4 files. With your localhost server, load the index.php file of this application.
- What is different about the displayed information on the page than in the Lab 5 example shown in class?
- Add
a new department. Name it MyNewDept. You may want to use
one of the existing department manager social security numbers, because
the foreign key constraint requires that you use an existing ssn. Take a screen shot of the page listing the departments with the new department, and include it for point #4.
- Now delete the new department. Take a screen shot of the page listing the departments, and include it for point #5.
- Open the file index.php. Write the line numbers of the code that has been added to handle the deleting of a department.
- The
very first time that this file is loaded, are there any conditions of
any IF statements that are TRUE? If so, what is the line number
of that IF statement? If not, simply write "no".
- The
very first time that the file is loaded, what is the first "try--catch"
block that is executed? List the line number of the "try".
- What does this try--catch block attempt to do?
- Does this try--catch block display anything on the screen?
- What line in this file (indirectly) causes the departments to be displayed?
- What file actually displays the departments?
- Open departmentFields.html.php
- Look at line 16. I thought this application was about deleting a department. Why is there a link to add a department?
- I
know that we covered this in the AddDepartment application, but why
does that link start with a "?" Shouldn't it have a URL?
What page is loaded if this link is clicked by the user? Write the complete URL, beginning with "localhost". (Hint:
this will be a "postback". If you are not sure of this answer,
load the page, click on "add department" and see what the url is!!)
- Line 27: there is a "get" and a "post" in the same form! What
is the "get" (copy the exact text that means "this is a get") and
what information does that pass when the form is submitted?
- What
is the "post" (copy the exact text that means "this is a post"), and
what information does that pass when the form is submitted? List
the variable(s) name(s) and value(s).
- What page is loaded (or reloaded) when the form is submitted?
- Why that page? I thought this was a postback. Why isn't departmentFields.html.php reloaded?