web-technology
ASSIGNMENT 3
Course Title: Web technologies Course code : IT230
Deadline : April 16, 2016 Marks : 4 + 3(Extra Marks)
Exercise 1 (4 Marks)
Q.1 What is the output of the following code? (0.5 Mark)
<!DOCTYPE html>
<html>
<body>
<?php
ECHO " My First PHP Program!<br>";
echo " My First PHP Program!<br>";
EcHo " My First PHP Program!<br>";
?>
</body>
</html>
Q.2 What is the output of the following code? (0.5 Mark)
<!DOCTYPE html>
<html>
<body>
<?php
$x = 2;
$y = 2;
function myTest() {
global $x, $y;
$y = $x + $y;
}
myTest(); // run function
echo $y; // output the new value for variable $y
?>
</body>
</html>
Q3. What will be the output of the code below and why? (1 Mark)
$x=5;
echo $x;
echo “<br />”;
echo $x+++$x++;
echo “<br />”;
echo $x;
echo “<br />”;
echo $x- - -$x - -;
echo “<br />”;
echo $x;
Q4. Given the following HTML form code, Write Ex2.php that displays all the input of the user (2 Marks)
<html>
<head>
<title>Personal INFO</title>
</head>
<body>
<form method="post" action="Ex2.php">
First Name:<input type="text" size="12" maxlength="12" name="Fname"><br />
Last Name:<input type="text" size="12" maxlength="36" name="Lname"><br />
Gender:<br />
Male:<input type="radio" value="Male" name="gender"><br />
Female:<input type="radio" value="Female" name="gender"><br />
Please choose type of residence:<br />
Steak:<input type="checkbox" value="Steak" name="food[]"><br />
Pizza:<input type="checkbox" value="Pizza" name="food[]"><br />
Chicken:<input type="checkbox" value="Chicken" name="food[]"><br />
<textarea rows="5" cols="20" name="quote" wrap="physical">Enter your favorite quote!</textarea><br />
Select a Level of Education:<br />
<select name="education">
<option value="Jr.High">Jr.High</option>
<option value="HighSchool">HighSchool</option>
<option value="College">College</option></select><br />
Select your favorite time of day:<br />
<select name="TofD" size="3">
<option value="Morning">Morning</option>
<option value="Day">Day</option>
<option value="Night">Night</option></select><br />
<input type="submit" value="submit" name="submit">
</form>
</body>
</html>
Bonus Question (3 Marks)
You are required to create 2 web pages that does the following:
1) Page 1: HTML Page that contains a form that collect information from user and pass it on to the next
page.
a) You need to validate user information (String, number, email,..)
b) Validation can be made on the same page or on the next page.
2) Page 2: PHP page that will receive data from previous page.
a) The page need to add the received information to a list in the same page.
b) You can either use cookies, arrays or database to store