Skip to Content

Aarron Walter

Updated 11.27.2007

Resources | Code Examples

These are just a few scripts I have written and have found useful enough to share with others. I am certain they can be improved upon, and probably have some errors. I distribute them without warranty and hope you will share modifications and improvements you make upon them. I'd love it if you would shoot me an email to let me know how you are using these scripts.

PHP Shopping Cart

Originally published by John Coggeshall on the Zend web site as a tutorial, I modified this shopping cart script to serve the needs of a project I was working on. This is a working example of how to use PHP Sessions to store products in a shopping cart.

Download [Zip 4k]

Contact Form With Server-Side Validation

This is a pretty simple PHP contact form that allows a visitor to email you from your web site. It validates for empty name, email, and message fields, as well as a valid email address. A great way to improve the form is by adding client-side validation too. My favorite approach is to use Prototype as explained at Dexagogo. It's as simple as including some JavaScript files, then adding the rel attribute to fields you want to validate.

Download [Zip 76k]

Ajax Mailing List Sign Up Widget

On many projects that I have worked the client needed to collect user emails in a mailing list to drive traffic back to the site or promote new products. This is a small form that can be placed on a home page or somewhere else conspicuous that allows a user to sign up for a mailing list without having to leave or refresh the page. It uses the Scriptaculous and Prototype JavaScript libraries to make an Ajax call to a PHP file that stores the user's info in a database or in a Mail Chimp list, which is more practical for managing the data and is great for sending rich email to customers. Code for both options is present in the storeAddress.php file. Comment out the one you don't want to use. You will need to set up your list at Mail Chimp, and to do so you will need to read their helpful PDF about the API. If you opt to store the addresses in your own database, see the SQL in the storeAddress.php file to help you build the appropriate table.

Download [Zip 23k]

Scriptaculous Slide Show

This simple slide show is used in my portfolio to show screen shots of projects I have worked on. It's a simple, yet elegant cross-fading photo slide show that is easy to expand and manage. This example uses the Scriptaculous and Prototype JavaScript libraries.

Download [Zip 503k]

Parsing RSS Using Magpie

This script demonstrates how to use Magpie, an open source set of PHP classes for parsing RSS and Atom feeds.

Download [Zip 13k]

How to Truncate Content

This simple example shows how you can truncate a paragraph for things like content previews on a home page.

Download [Zip 1k]

Christmas Gift Exchange Name Drawing Script

Perhaps technological over-kill, but this script solved a problem my family has of not being in one place to draw names for our holiday gift exchange. It's short, simple, and makes use of PHP Mailer, my favorite PHP email class to let people know what name they "drew".

Download [Txt 1k]