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.
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.
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)
a.Define an explain a well-formed XML document.
b.Explain how a JSP document is processed by a web-server.