Page 244 - Computer Software Application TP - Volume 1
P. 244
COMPUTER SOFTWARE APPLICATION - CITS
echo $status = (empty($user)) ? “anonymous” : “logged in”;
echo(“<br>”);
$user = “John Doe”;
echo $status = (empty($user)) ? “anonymous” : “logged in”;
?>
3 Save the program in C:\Apache24\htdocs in a folder with .php extension
4 Run the Apache services from windows services
5 Open the browser and type the following address
http://localhost/foldername/
6 Click the php file to run and verify the output
TASK 5: Using While statement
1 Open the text editor
2 Write the following codes
<html>
<head> <title>PHP </title></head>
<body>
<?php
$x = 1;
while($x <= 5)
{
echo “The number is: $x <br>”;
$x++;
}
?>
<p>END</p>
</body>
</html>
3 Save the program in C:\Apache24\htdocs in a folder with php extension
4 Run the Apache services from windows services
229
CITS : IT & ITES - Computer Software Application - Exercise 51