Phpdynamic

PHP and MySQL Programming Guides, Tutorials, & Articles

Posts Tagged Beginners

What Are Variables?

MAR 18

PHP Variables

We can all probably remember variables from algebra class during our high school years, remember expressions like x + 2 = 10 or something fun like 5x(-3x3)2 ? Well, maybe some of us can, don’t worry were not going to be solving any equations here. Anyways, besides this nostalgic moment, how do variables fit into the picture?

A variable is a location in a computer’s memory, identified by a symbolic name, that can hold different values of data at different times during the execution of a program. Variables can store and retrieve data that is essential to your scripts, things like the number of visitors to your website, the total amount due at checkout, the name of the person currently logined in, or the age of the user can all be stored in variables.

Read more…

Beginning PHP – Language Syntax

MAR 11

Syntax and Semantics

All programming languages must follow a proper syntax, which is a set of rules that control the arrangement of words, numbers, and symbols for writing valid code; and PHP is no exception. In the same sense that English sentences have to follow certain grammatical rules to have a proper meaning (semantic), all PHP statements must follow a certain set of syntax rules to execute correctly.

Read more…

Beginning PHP – The Fundamentals

MAR 10

The Whole Picture

You have an operational web server with PHP installed and configured, and you might be wondering how all the pieces fall together and perform anything useful. Before we move along any further, we would like to share the underlying concept on how PHP and Apache work together; as this will provide you with a solid foundation to understanding the examples used throughout the tutorial.

Read more…

Getting Started with PHP

MAR 10

What is PHP?

PHP is a general-purpose scripting language that is widely used for web development. The official name for PHP is Hypertext Preprocessor, it is embedded directly within an HTML page and interpreted by the web server every time the page is loaded. One of PHP’s greatest advantage is its practical and simple design, allowing both beginning and experienced programmers to quickly develop dynamic content for websites and larger web applications.
Read more…

What are Arrays?

NOV 30

Introduction to Arrays in PHP

In previous tutorials we explained the concept of variables, which are named memory locations used to store a single value or piece of data. In a way arrays are similar to variables, but instead of just storing an individual piece of data, they can store groups of related data. A list of e-mail addresses, names of employees, or a list of products, are just some examples of data that can be stored in an array. Essentially any data that can be grouped together can be stored in an array. Once your understand the concept of arrays, it will become impossible to program without them.

An array can consist of any number of elements, or in other words data, were each element is distinguished and referenced by a unique identifier called a key. Array elements by default have numerical keys which are indexed sequentially, but they can also be indexed by user defined keys. An array that is indexed by numbers is called a numerically indexed array while an array that is indexed by strings is called an associative index array.

Numerically Indexed Arrays

In a numerically indexed array each element is indexed sequentially by an integer starting from zero by default, were the key or index relates to the element’s position within the array. Below is a simple illustration of an array. Note, the resemblance between the arrangement of an array and a table. The first column is the unique index of the array element and the second column is the actual data value. Each subsequent row follows the same pattern.

array table

Read more…

Working with Forms in PHP – Part 2

NOV 18

Form Elements with Multiple Values

In the first part of this tutorial, we worked with input boxes and radio buttons, which only allow a single data value to be submitted per form element. We are not limited to single values, because HTML also allows form elements such as check-boxes and select-boxes that allow the user to choose multiple items simultaneously for a single form field, so we need a way to process them a little differently in PHP. Lets start with an example:

Read more…

Working with Forms in PHP – Part 1

OCT 28

Forms are everywhere on the Web, you use them to enter your billing details while shopping on-line, writing a comment on a blog, or while preforming a search. Regardless, forms are essential to making the Web interactive. In this tutorial we’ll show you how to use PHP to process HTML forms. A prerequisite for this tutorial is a basic knowledge of HTML forms, a good reference is Htmlgoodies.

Read more…