Subject Computer Science Web Development (HTML, XML, PHP, JavaScript, Adobe, Flash, etc.)
Question
1 Introduction to PHP
Overview
This lab walks you through using PHP to create simple applications. PHP is popular for many Web applications, so becoming comfortable with the syntax of PHP will help you diagnose and identify potential security issues.
Learning Outcomes:
At the completion of the lab you should be able to:
1. Execute PHP scripts at the shell prompt within the Ubuntu virtual machine
2. Create simple PHP applications comprised of basic syntax, variables, strings, selection statements and repetition statements. Lab Submission Requirements:
After completing this lab, you will submit a word (or PDF) document that meets all of the requirements in the description at the end of this document. In addition, yourPHP file should be submitted . You can submit multiple files in a zip file.

Part 1
– Execute PHP scripts at the shell prompt within the Ubuntu virtual machine
The Virtual Machine already has PHP installed. It is also configured to run properly on your Apache2 web server. This exercise will walk
through creating a simple PHP script and running it both at the shell
prompt and from a Web browser. We will use the gedit text editor to create the PHP file.
Running the script from the shell prompt is very useful for debugging as syntax errors will appear when code issues occur.

3.To create a new document just begin typing or copying and pasting the PHPcode shown below:
<!DOCTYPE html>
<!--
HelloPHP.html
-->
<!--
Jan 22, XXXX
-->
<html>
<head>
<title>My First PHP Script </title>
</head>
<body>
<h1>Welcome to SDEV 300. </h1>
<h1>The following greeting is from PHP </h1>
<?php
echo "Hello, SDEV 300 students and class!</br>";
echo "The current time is " . date("g:i:h a"); ?>
<p>
</body>
</html>
Save the file in the /var/www/html/week
3 folder in a file named
helloSDEV300.php
. Note,
you may need to create a folder named week 3 . Recall the /var/www/html is the location of the Apache2 web server html files. Creating separate folders for each week or application will help organize the server.
Solution
<!DOCTYPE html>

<html>
    <head>
       <meta charset="UTF-8">
       <title></title>


    </head>
    <body>
       <?php
       $radius = 2.65;
       $length_r = 4.2;
       $width = 5.6;
       $base = 10.2;
       $heigh = 5.4;
       $length_s = 5.3;
       ?>

       <table border="1" width="800">
            <tr>
                <td style="text-align:center; vertical-align:middle;">
                   Circle
                   <img src="img/circle.png" alt="" width="40"/>
                   <br />
                   Area =
                   <?php
                   $result = 3.14 * $radius * $radius;
                   echo $result;
                   ?>
                   square meters
                   <br />
                   Circumference =...

This is only a preview of the solution. Please use the purchase button to see the entire solution

$15.00
Assisting Tutor

Related Homework Solutions

Get help from a qualified tutor
Live Chats