Lab Analysis

 

A sample of this lab is available online for you to test and examine:
http://bcitcomp.ca/twd/lab04_sample/
REQUIREMENTS WRITE A PHP SCRIPT WITH THE FOLLOWING PROPERTIES:
▪ Obtain the file lab04_external_data.php available from the shared FTP.
▪ Define the following functions in an external file:
– formatName( ): This function takes a string as a parameter and returns the same string,
formatted to ensure it is all lowercased except the first letter, which is uppercased.
Investigate the is_string( ) function and use it to ensure incoming data is in fact a string.
Also investigate the strlen( ) function and use it to ensure the incoming string is at least
two characters long. If the data is invalid, return the string “Student”
– buildListOfLinks( ): This function should take an array as a parameter, and build a valid
HTML unordered list. Each list item should contain an anchor tag. Both the href attribute
and the data of the anchor should be taken from the parameter array. The result should
be a list of clickable hyperlinks. Investigate the is_array( ) function and use it to ensure
the incoming data is an actual array, and also use the count( ) function to ensure the
array contains at least one item of data. If the array is invalid or does not contain data,
return a descriptive error message to the invoking instruction.
▪ Write a script that outputs valid HTML and includes both your functions and the
lab04_external_data.php file. Demonstrate the error checking in the functions by
invoking them many times, each time passing different data, some of which is valid data,
some of which is invalid. Use ALL the variable data defined in the
lab04_external_data.php file.
HINTS Write your script in stages, testing as you go, eg: solve the problem of
displaying a list of links from an array before you try to do so inside a function.
SUBMISSION When complete, demonstrate to your instructor the script running on your web
server along with your source code before the end of day (4:00pm).
Compress all files and folders into a .zip named using your full name and lab
number, for example: lastname_firstname_lab04.zip Upload this file to the
TWD shared FTP server lab04 folder before the end of day.

 

 

This question has been answered.

Get Answer