Page 262 - Computer Software Application TP - Volume 1
P. 262
COMPUTER SOFTWARE APPLICATION - CITS
// Do something with the data (e.g., display it)
echo “Name: $name<br>”;
echo “Email: $email”;
}
else
{
// Redirect or display an error if someone tries to access this script directly
header(“Location: index.html”);
exit();
}
?>
</body>
</html>
• Save the program in C:\Apache24\htdocs in a folder with .php extension
• Run the Apache services from windows services
• Open the browser and type the following address
http://localhost/foldername/
• Click the index.html file to run and verify the output
TASK 4: Display environment variables
• Open the text editor
• Write the following codes
<?php
echo $_SERVER[‘PHP_SELF’];
echo “<br>”;
echo $_SERVER[‘SERVER_NAME’];
echo “<br>”;
247
CITS : IT & ITES - Computer Software Application - Exercise 53