Homework: Loops in PHP
Woohoo! Let’s have fun. Create a new file called loops.php. Do this! For loops Print out 1+2+3+4+5+6+7+8+9 on one line. There will be no “+” at beginning or end. Print out the sum of that loop after. Copy over our animal array to here – save you some time. Loop through the array and print…
Read MoreHomework: Play with Arrays
We are going to play with arrays a little so make a new file called arrays.php and let’s have some fun. Create an array called $animals and put 4 of your favorite or not so favorite animals in there. Create an echo statement that prints out a sentence like this: “My favorite animal is ____.…
Read Morefor & foreach Loops
There are several kinds of loops – we will learn about for loops first. for Loops A for loop is a loop that will repeat a set number of times. These have very similar syntax to JavaScript – and similar functionality to Python. Depending on where you are coming from. Here is the basic structure:…
Read MoreNew Form Inputs with HTML5
Not enough permissions to view this content.
Read MoreForm Handling
PHP is generally used for form processing. There are two critical pieces to using PHP to process your form. Designated what action the form should take after the user clicks on the Submit button. The easiest method is to have it direct to a separate PHP script such as myscript.php. Pass the values that the…
Read MoreHomework: Conditionals
Not enough permissions to view this content.
Read MoreExercise: Variables, Strings & Numbers
Create a new file called first.php – then… Create the basic HTML structure. In the <body> section, create a <h1> tag with a header that says “My first PHP program”. Create three variables and set them equal to a integer number, float number and boolean. Create three string variables and store 1-3 words in each.…
Read MoreIntro to Functions
Features of functions Every programming language lets you create blocks of code that when called will perform a given task. Functions can return an output value. Functions generally are given one or more values as input. These are called parameters. The function contains instructions used to create the output based on these inputs. For example,…
Read MoreWhat Makes PHP So Cool. And Useful.
We touched on this on the previous page but what does friendly with HTML mean? Basically, you can easily embed PHP in HTML which allows you to do all sorts of cool things. In fact, it is the foundation for how you will create the web app you are going to make. Mixing PHP &…
Read MoreHomework: Making a Form
For this week, create a form that we can work on creating scripting for next week. It should have: At least one input of type text. At least one input of type radio or checkbox. At least one input of type textarea At least one select input. One password input A submit button. Steps: Create…
Read More