joshaallen / WDV341-PHP-BASICS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unit-3 PHP Basics

3-1: PHP Basics

Create a PHP page for this assignment. Use a combination of PHP, HTML and Javascript to perform the following processes.

NOTE: Putting your PHP variables into a separate file is optional.

Use the WDV101-DemonstrateInputForm example code for this assignment.

  1. Create a variable called yourName. Assign it a value of your name.

  2. Display the assignment name in an h1 element on the page. Include the elements in your output.

  3. Use HTML to put an h2 element on the page. Use PHP to display your name inside the element using the variable.

  4. Create the following variables: number1, number2 and total. Assign a value to them.

  5. Display the value of each variable and the total variable when you add them together.

  6. Create a PHP variable that is an array containing the values 'PHP', 'HTML' and 'Javascript'. Then, use a PHP loop to iterate through the array and create a javascript array that contains those values. Lastly, write a javascript script that displays the values of the array on the page.

  7. This may seem trivial and repetetive, but often times PHP objects/arrays will be returned to your javascript so that you can use the data to interact with the DOM. Especially when using AJAX to talk to your PHP.

About


Languages

Language:PHP 53.7%Language:SCSS 43.2%Language:JavaScript 3.1%