Question One

Suppose you have a PHP page that receives requests from the following HTML form: see image.

< form action="validate.php" method="get">
< label>Enter your first name:
< input type="text" name="fname" />
< input type="submit" value="Send" />

The form has only one field fname and send its requests as get.

Write the PHP condition where you will validate if the request is empty. If the condition is true, print the message The field is empty. Note: Dont waste your time writing the entire PHP code, just write the if condition.

Question Two

In PHP, create a class called Person that has two variables first_name and last_name and a function called fullName(). When this function is called, it will return the first name concatenated with the last name variables of the object.

This is how we will use the person class (the following code should work with your code):

$omar = new Person();
$omar->first_name = "Omar";
$omar->last_name = "Mohammad";
print($omar->fullName());

The output for the previous code will be: Omar Mohammad.

Question Three

Consider below the Students table defined inside the database named SEU which you have created using Microsoft Access Database:

Name ID Phone
Ahmad 12311 0213312111
Ali 12001 0225443661
Yahya 15321 0259928118

Write Java/JDBC statements to perform the following tasks for above database:

a.Import the relevant JDBC packages which your program will require for performing the JDBC operations.

b.Define the database connection URL string.

c.Using the URL defined in part(b), open a connection with the database SEU (assume username and password of your choice)

d.Create a JDBC statement object for use with the connection created in part(c).

e.Create SQL query string to select all the columns from Students table above.

f.Execute the query created in part(e) and save the results in appropriate variable/object.

g.Display the results obtained in part(f) using println method.

h.Close the connection you created in part(c)

Question Four

a.Define an explain a well-formed XML document.

b.Explain how a JSP document is processed by a web-server.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.