How To Populate A DIV via an HTML SelectBox, PDO, and jQuery

Imagine you have a database full of information, and you want to let users browse that data in the simplest way possible. Say you have a wide selection of data surrounding song titles & their artists, and you want to create a simplified search system that lets users select a song and instantly see who […]

How To Validate Form Data With PHP

Whenever you’re dealing with online forms it’s important to perform proper validation on the data that is submitted. Form validation ensures that the user will enter valid data on the form – minimizing your chances at possible SQL injections. PHP lets us perform server-side validation, and lets us display the appropriate error messages if a user […]

Understanding PHP Constants

A constant within PHP is essentially an identifier for a simple value, and unlike a variable, the value of a constant cannoyt be changed after it is declared. By default a constant is case-sensitive; and most people tend to give constant identifiers uppercase names. To get started you will want to define a constant using the […]

Get A Users Gravatar Image Via PHP

Gravatar’s have been popular for years now – and to date they’re integrated across a plethora of websites – serving over 8.6 million avatars every single day. With that said there are also a ton of plugins available for most blog and CMS scripts; however what if no plugin exists for our website, or we […]

The 10 Things All PHP Programmers Should Know

The Internet as we know it was built by webmasters, designers, and developers who got their start thanks to a slew of free resources and tutorials that were available to them. This is something that I have always streamed to maintain with Rapid Purple – and it seems Josh Leskar and his team over at […]

Auto Generation of New Prospects in eLEAD CRM via ADF XML Emails

Earlier in the week I had to do a rather niche task with a local leasing company I work with. They have switched over to eLEAD CRM and as such wanted to convert all of their online lease quote request forms to submit to their new eLEAD CRM. This way requests from existing customers will […]

The Basics of PHP Classes and Objects

As you learned in previous tutorials functions provide a way for you to divide your program’s tasks into separate, smaller tasks. Classes and objects are somewhat similar in helping you to organize your program. They are used to create collections of related variables and functions, which can be used to more accurately represent real-life situations. […]

FOR and FOREACH Loops

Much like WHILE loops FOR and FOREACH loops are meant to enable the repeated execution of a section of code. However, unlike while statements, for and foreach have features built into them to update the sentinel value for every repetition. So lets go back for a moment to our original example in the WHILE loops tutorial – […]

String Manipulation – Using STRPOS and STR_REPLACE PHP Functions

So we have substr and strlen PHP functions covered now – however there is alot more PHP can do out-the-box with strings. Let’s say we are storing the users full name within our database in a single column in the following format firstName-lastName. However on our frontend we want to be able to echo out the […]

String Manipulation – Using SUBSTR & STRLEN PHP Functions

Now that we’ve covered the basics of what functions are within PHP – PHP has a wide array of functions already available for you to use to work with various strings. So let’s say that we have a variable holding a user’s telephone number and we’re asking our user to input the last 4 digits of […]

The PHP Switch Conditional Statement

The switch statement allows you to simplify our previously written if…elseif…else statement by not constantly writing out the condition to check for. So, let’s take our code: And rewrite it in the form of a switch statement. This is how it works: First we have a single expression n (a variable in our case called […]

Understanding IF / ELSE / ELSEIF Statements

The majority of the time your PHP application or script will vary depending on different conditions. These conditions can be set via the script itself, or from user interaction – regardless your PHP script needs a way to handle these different situations. This is where conditional statements in PHP are introduced. PHP has several different […]

Issuing SQL Statements Using PHP Data Objects

This tutorial expands upon our previous PHP Data Objects tutorial, which discusses how to connect to a MySQL database, and showcases how to communicate with that MySQL database once you are connected. Depending on the type of query you want to run you’ll be issuing statements in two different ways: For example let’s say you need to […]

Connecting To A Database Using PHP Data Objects

With the release of PHP 5.5.0 the mysql_* functions have become deprecated and as such connecting to a MySQL database with PHP 5.5 and up will require the use of either PHP Data Objects (PDO) or an individual MySQL driver (MySQLi). Throughout this tutorial we will focus on utilizing PDO to connect, access, and disconnect from […]

Including Another File Within Your Script

Almost all online scripts and applications will feature a core library of variables and functions that get utilized throughout the script. For example, let’s say you’re writing a database intensive application. You could declare your MySQL details within each page of your script – however if you ever changed your password that would mean that […]

Sending Mail with PHP

Mail is extremely easy to send from PHP, unlike using scripting languages which require special setup (like CGI). There is actually just one command, mail() for sending mail. In this tutorial we will discuss how to use PHP’s mail() function. It is used as follows: mail($to,$subject,$body,$headers); In this example I have used variables as they have […]

PHP/MySQL File Upload – Error Checking

A while back I had written a PHP/MySQL tutorial discussing how to upload an image to your server, and store the information about that uploaded image into your MySQL database. That tutorial covered really only the basics, and I knew that eventually someone would post a comment asking about some more advanced features – such as […]