Build web applications using PHP and MySQL

 

Question One

1.Create an HTML form that accepts the user’s input to enter his/her first name, last name and sex.

2.Create a php file that displays the following sentence:

Hello first name laste name, welcome to IT405.

The sentence should be colored in blue or pink according to the sex..

Your program output should look as shown below.

3.Include the screenshot of the program output as a part of your answer.

Marking Criteria

-HTML form 1 mark

-PHP code 1 mark

-Screenshots 1 mark

3 Marks

Question Two

1.Given the following HTML form code, write a php file that displays all the input of the user as a list.

<!DOCTYPE html>

<html>

<head>

<title>Registration</title>

</head>

<body>

<form method=“get” action=“file.php”>

First Name:<input type=“text” name=“first”><br />

Last Name:<input type=“text” name=“last”><br />

Email:<input type=“text” name=“email”><br />

Level:<input type=“text” name=“level”><br />

<input type=“submit” value=“submit” name=“submit”>

</form>

</body>

</html>

Include the screenshot of the program output as a part of your answer.

Marking Criteria

-PHP code 2 marks

-Screenshots 1 mark

2 Marks

 

Question Three

1.Write a PHP program to create a new string where IT’ is added to the front of a given string. If the string already begins with ‘IT’, the program returns the string unchanged.
Sample InputOutput
“405”  IT405
“403” IT403
“IT401” IT401

2.Include the screenshot of the program output as a part of your answer.

Marking Criteria

-PHP code 1.5 marks

-Screenshots 0.5 mark