Reference no: EM131109281
PHP: Arrays, Functions and Form processing
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. It is not envisioned you will become an expert in PHP from this course, but you will be able to create simple Web applications; and, in the near future of this course, analyze that code for security issues.
Learning Outcomes:
At the completion of the lab you should be able to:
1. Create and test PHP scripts that include Arrays
2. Create and test PHP scripts that include Functions
3. Create, and test PHP scripts to process HTML Forms
4. Compare and contrast session creating mechanisms in PHP
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, your Web Application files should be submitted. You can submit multiple files in a zip file.
Virtual Machine Account Information
Your Virtual Machine has been preconfigured with all of the software you will need for this class. The default username and password are:
Username : umucsdev Password: umuc$d8v
Part 1 - Create and test PHP scripts that include Arrays
This exercise will walk through creating a PHP script that creates, uses and manipulates arrays. We will use the gedit text editor to create the PHP file in the Virtual Machine.
1. After launching the gedit text editor, create a new document and type or copy and paste the PHP code shown below:
2. As before, you can also run the PHP code directly from the shell prompt. To run from the shell prompt, open a shell prompt, change to the location of the ArraysDemo.php file and type:
php ArraysDemo.php
Running from the shell may provide some insight when you php Errors that prevent the cause the script to stop running prior to producing the HTML output.
Part 2 Create and test PHP scripts that include Functions
In this exercise we will create a PHP web page that uses both existing and user-defined PHP functions. Functions are used to help organize code into sub-units to allow for code reuse and reproducible results.
1. Copy and paste the following code into a file named FunctionsDemo.php in the /var/www/html/week4 folder on your Virtual Machine.
2. Launch your Firefox browser and run the Web application. Assuming you placed the file in the /var/www/html/week4 folder you can run this by typing the following URL on your Virtual machine: localhost/week4/FunctionsDemo.php.
3. Reviewing the code you should note the following:
a. Existing PHP functions can be used easily by calling the function name and any required parameters. For this example, sqrt(), deg2rad(), sin(), cos() and tan() existing functions were called.
b. PHP functions you create should be of the format.
https://www.dropbox.com/s/d9micawv81nihae/Lab_PHP_and_Web_Forms.rar?dl=0
Prerequisite information for modules
: STAGE 2 - XML/XQueryConstruct XML representations for the following. Express your design using a diagram and/or a schema.1. Composition of courses, i.e. a list of the modules that make up a course. You may assume that the composition of a course does..
|
Reaction occurs at constant pressure
: Suppose that 0.330 mol of methane, CH4(g), is reacted with 0.480 mol of fluorine, F2(g), forming CF4(g) and HF(g) as sole products. Assuming that the reaction occurs at constant pressure, how much heat is released? Express your answer numerically ..
|
Prepare a pension worksheet for beatty company for 2010
: During 2010, service cost was $27,500, the settlement rate was 10%, actual and expected return on plan assets were $25,000, contributions were $20,000, and benefits paid were $17,500. Prepare a pension worksheet for Beatty Company for 2010.
|
Create a chart showing milestones in memory growth
: Create a chart showing milestones in memory growth and the approximate date
|
Create and test php scripts that include arrays
: Create and test PHP scripts that include Arrays. After launching the gedit text editor, create a new document and type or copy and paste the PHP code.
|
Calculations required to evaluate forrester''s proposed
: which would increase to 300,000 units per year. Forrester requires a 12% return on investments. Show all necessary calculations required to evaluate Forrester's proposed relaxation of credit standards.
|
A business case for implementing an e-procurement system
: Identify a company that you are familiar with and provide one example of a commodity product they use. I pick WW Grainger as my company. They sell hardware like wrenches.
|
Compute warrens actual return on plan assets
: During the year, contributions to the pension fund were $120,000, and benefits paid were $200,000. Compute Warren's actual return on plan assets.
|
Find out if this is the company that has been charging me
: find out if this is the company that has been charging me?
|