Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Technologies for Web Applications COMP2020, Sample Quiz

Sample Questions

ADDITIONAL FILES REQUIRED FOR THE SAMPLE QUIZ ARE IN THE ROOT OF THE ZIP FILE.   ADDITIONAL FILES REQUIRED FOR THE QUIZ WILL BE PROVIDED ON THE DAY OF THE QUIZ IN YOUR QUIZ ACCOUNT.

1.    The file Question1.txt, which contains the text to be used for this question, can be found in the root folder of the zip file for this sample quiz. Add the necessary HTML code to mark up the content as follows using appropriate HTML5 tags:

•     Divide the text up into paragraphs.

The heading should be a level 1 heading.

•     The line starting 'Sources of...' should be a level 3 heading.

•     This heading should be followed by the list sources, marked up as an unordered list (ie bullet list).

•     'Australia Telescope Compact Array' should be in bold

•     '(ATCA)' should be a hyperlink, linked to http://www.narrabri.atnf.csiro.au/

Save the resulting file as Question1.html, and make sure it passes the W3C validator.

2.   Copy Question1.html into a new file called Question2.html (make sure to keep a copy of Question1.htm unchanged). CSS to the file to carry out the following:

•     make the level-1 heading 1.7 em in size

•     make the list text 1.2 em in size

•     make all text white on a blue background

•     make the level-3 heading text white on a black background

•     put a red border around the body

Note: you may have to make some changes to the HTML in Question2.html in order for your CSS to work.

Save Question2.html and make sure it passes the W3C validator.

3.The WAASAAS airline (Western Australia and South Australia Air Service) is conducting a web-based survey of its     frequent fliers from Sydney. The survey form used for this is implemented in Question3.html, which is provided in the root folder of the zip file for this sample quiz.

Add the following JavaScript functionality to the form:

The JavaScript function CheckForm() is to be called upon form submission, but the function is currently empty. Add JavaScript code to the function in order to carry out the following validations:

•     Check that the phone number begins with (02) and then followed by 8 numeric digits

•     Check that the favourite destination text box has been filled in

•     Check that the preferred meal type has been chosen

If the inputs are valid, the form should submit.

When errors occur in user input the user must be alerted to these errors through appropriate inline messages (not alert boxes) and the form should not be allowed to submit.

Save Question3.html.

4. Question4.html which contains the form to be used for this question can be found in the root folder of the zip file for this sample quiz. This form allows the user to select which orders are to be listed from a MySQL database. - do not modify this html file in anyway.

Create Question4.php page (which is the action for the form) so that it does the following:

•     Connects to the MySQL database called electrical (the connection details are given on the following page).

•     Retrieves from the electrical database, and displays in a table, the orderID, orderDate, shippingDate, customerID, firstName, lastName, postcode in ascending order of the orderDate for all orders that meet the criteria as entered by the user on the form. Eg, if the user selects Shipped in the selection list then all orders that have been shipped for the Customer ID indicated by the value in the text box must be shown. If the user selects Not-shipped in the selection list   then all orders that have not been shipped for the Customer ID indicated by the value in the text box must be shown.

•     To simplify your coding, validations are not required on user inputs. However, you should sanitise user input by calling the escape_string() function if an SQL injection attack is possible through that user input.

•     Only display the output table if there are orders which meet the criteria indicated in the form by the user, otherwise

display the message: No orders were found that match your criteria.

Save Question4.php.

The following database description applies to question 4. The two database tables relevant for this question are the customer and purchase tables. The relevant fields, including data types, are shown below. Relevant database connection information is also shown below.

Database Connection Information

Type of database Name of database           Location of database       Username to connect      Password to connect

MySQL electrical localhost TWA_student TWA_2022_Autumn

electrical Database (only tables relevant to this question are shown)

Table name: customer (This table provides details about customers that have placed orders)

Field

Type (size) Description

customerID int Unique customer identifier

firstName varchar(30) Customers first name.

lastName varchar(30) Customers last name.

address varchar(150) Customers residential address.

suburb varchar(25) Customers suburb of residence.

state varchar(3) Customers state of residence.

postcode int Customers postcode of residence.

Table name: purchase (This table gives details of all orders placed by each customer)

Field

Type (size) Description

orderID varchar(7) Unique identifier for an order

customerID int Customer id of customer that placed this order

orderDate datetime The date the order was placed by the customer

shipped

char(1)

An indicator for whether the order has been shipped to the customer. Possible values are Y or N

shippingDate datetime

The date the order was shipped to the customer (if it has been shipped). If the order has not been shipped then this field is empty.

staffID int The staff id for the staff member that shipped the order to the customer.