Web Design Tutorials: Photoshop, HTML, Flash, PHP
Currently Browsing: Php Tutorials

PHP Tutorial – How to Create Kick-Ass PHP Contact Forms

I am sure that almost everyone can agree on the importance of contact forms for use on everything from static HTML websites, to WordPress powered websites. I found myself many times creating custom PHP contact forms for clients and always changing things around to suit the needs of the client. After going through this article you should have a better understanding of creating custom PHP contact forms. These can...

PHP Tutorial – Best Way to Optimize JPEG Images of Website with ImageMagick and PHP

Optimize images of website is really helpful for save bandwidth and website make more faster. Big website is really need to that. Because they huge user and serve their site to them is really challenging. To optimize the images for your existing website, the following code might be useful: $dir = '/home/some_directory/'; // the directory with your files $compr = 80; // the quality precentage if ($handle =...

PHP Tutorial – Pivot tables

In my work as developer I normally need to transform data from one format to another. Typically our data input are a database and we need to show database data into a report, datagrid or something similar. It’s very typical to use pivot tables. It’s not very dificult to handle pivot tables by hand but the work is always the same: groups by, totals, subtotals, totals per row …. Now I want to write a class...

PHP Tutorial – Tabbed Ajax Content Pane

Hello and welcome to my first tutorial! Aims: By the end of this tutorial you will, hopefully, be able to create a simple tabbed content area.  This will allow users of your website to view a wide variety of content from an infinite number of tabs(within reason) all in one content space! Creating The Database This is probably the easiest part of the tutorial so we might as well do it first!  Open up phpmyadmin...

PHP Tutorial – Check For Empty Values

In this tutorial we will create a function to check if a field is empty in either a string or an array. So this could be used to do a simple check on if a form field is left blank. I will show you an example on how to use it to check if a form field is empty. So heres the function function empty_check($var){ // Start Function if(is_array($var)){ // Determine if $var is an array or not foreach($var as $key...

PHP Tutorial – How to use Explode

The explode function is used to grab certain information out of a file or string. This tutorial will show you how to explode out of both a file and a string. Explode Structure explode ( string $delimiter , string $string [, int $limit ] ) Explode From A String <?php $string = "Peter;Mark;Rupert;Jack;Harold;Daniel"; // String containing names seperated by ; $explode = explode(";",$string); //...

PHP Tutorial – Check what people searched in search engines for your site

Find out what people have searched on search engines to access your website. A similar feature can be found on google.com/webmasters but that’s is a 3′rd party script where as this can be hosted directly on your site. So first we need to choose what search engines we want recorded. To do this I will do the examples on google and yahoo. First go to google.com and search for PK-Tuts then look into the address bar...

PHP Tutorial – Create A Captcha Form

This tutorial will teach you how to protect your form’s from being submitted by bots. We will use a simple way, by creating a image using php with some randomly generated numbers then store it as a session and when the form is submitted we will check if the field in the form matches up with the numbers generated. So lets create the image and the random numbers. image.php <?php session_start(); // Start...

PHP Tutorial – If/Else/Else If Beginners Tutorial

After contact from some visitors starting to learn PHP. I am going to be writing a few tutorials on the basics of PHP. In this tutorial we will cover how to use the If Statements. If statements are used to check if something matches something else. The syntax for a simple If statement is as if(statement){ // if statement matches run any code here } If it doesn’t match then ignore. In statements we may need...

PHP Tutorial – Simple object orientated template system

I’ve always been a fan of the wordpress template system, Its easy to use and very powerful. Expression Engine has a similar template system in place and today we will be writing a class which will host many of the same features and will give you an extremely flexible and powerful template engine to work with. Structuring our class view plaincopy to clipboardprint? class template { private $globals =...

PHP Tutorial – Store An Array

In this tutorial we will learn how to encrypt an array with base64 and then serialize it so we are able to store it in a database without loosing the integrity or values. So lets start by creating 2 functions the first of which will encrypt and serialize the array. function store_encrypt($array) { // Start function with function name store_encrypt. if (!is_array($array)) { // Check if $array is an array...

PHP Tutorial – PHP File Downloads with Speed Limit

PHP can be used to securely control access to file downloads. This tutorial will show how you can send file through a PHP script and limit the download rate. The function we will write accepts the path to the file to send and optionally a rate in kB/s to limit the transfer speed. The function should also be able to handle range headers from clients that allow stopping and resuming downloads. Sending Files First, we...

« Previous Entries Next Entries »

Powered by WordPress | Designed by Elegant Themes