Professional Documents
Culture Documents
A1
190160116014
1
En no 190160116103
190160116014 A1
Assignment-1(PHP)
Q.1) Write a PHP script to get the PHP version and configuration
information.
Program:
phpinfo(); ?>
</body>
</html>
En no 190160116103
OUTPUT:-
190160116103 A1
Q.2) Create a simple HTML form and accept the username and display
the name through PHP echo statement.
Program:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form action="" method="POST">
<input type="text" name="name" id="name" placeholder="Username"><b r>
<input type="submit" value="submit">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["name"];
echo "$name";
}
?>
</body>
</html>
7
190160116103 A1
O
u
t
p
u
t
8
190160116103 A1
"<br>"; echo
$_SERVER['HTTP_USER_AGENT'];
?>
</body>
</html>
9
190160116103 A1
OUTPUT: -
Q.4) 4 Write a PHP script to delay the program execution for the given
number of seconds.
Program:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php echo "Before delay " .
?>
</body>
10
190160116103 A1
</html>
OUTPUT: -
11
A1
190160116014
Q.5) Create a PHP script which displays the capital and country
name from an array. Sort the list by the name of the capital.
Program:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php echo "Before delay " .
$country = array(
"India" => "Delhi",
"UK" => "London",
"Pakistan" => "Lahore",
"Afghanistan" => "Kabul",
"Japan" => "Tokoyo"
190160116014