Archive for the ‘PHP Programming’ Category

Custom Mailing Labels via PHP Programming

Monday, July 11th, 2016

One of the quick side projects I worked on in the past two weeks was a contract PHP programming job for a clubhouse in Marlborough, MA.

The business requirements:

  • User to enter a cut-off date
  • Print pages of labels for all members who
    • Had been in attendance since the cut-off date, AND
    • Belonged to a “certain” subset of members
  • Labels need to be formatted for Avery 5160

avery 5160 labels diagram

The clubhouse data is stored in MySQL tables in a database on their Intranet. There are over 1,000 members listed in the members table. Some are active and some are no longer active. Those who attend the clubhouse are checked in with a barcode reader, and that data is stored in an attendance table on the Intranet.

Programming solution:

  • User to enter a cut-off date
    In order to avoid formatting and “real” date validations, instead of creating an open data entry field, a drop-down select field loaded with valid attendance dates was created.  The user just scrolls the list. (Only the last 120 days are presented (a calendar presentation (i.e. jQuery datepicker) does not work for this client.))
  • Print pages of labels
    • Using the IDs of members in attendance from the cut-off date to the present date, a lookup on the members table indicates whether the member belongs in the “certain” subset mentioned above. If so, a label is formatted for that member. If not, the program skips to the next member ID.
    • Once all the IDs have been processed, a precisely formatted PDF file is displayed to the user.
    • The user can send it to the printer using the Adobe® Reader® print symbol (without having to adjust margins or orientation), and, can save it on the local system in order to have a record of recipients for that mailing.

The programming solution includes PHP, MySQL, and FPDF (for creating the PDF).

A fun diversion in the middle of creating WordPress websites!


PHP Programming Helps the Chamber Streamline Processing

Thursday, October 15th, 2015

An interesting PHP programming project that I recently completed was for the Marlborough Regional Chamber of Commerce. The business goals were to:

  1. Consolidate the steps required to upload membership information to the website
  2. Provide mechanisms for Chamber staff to be able to
    • Upload the membership information themselves (without technical intervention)
    • Do the upload on demand, whenever they wanted

The Importance of the Membership Upload

The Membership Upload not only updates the list of members, but also populates the table that holds the list of members’ discounts and another table that stores valid business codes. Information uploaded during the process is used to display the Business Code selections on the Find a Member page, the search results on the Find a Member page, and the list of members participating in the EMB (member discount) program. So, if the program were to fail, there would be unsightly voids and misbehaving functions on the website.

Starting Membership Upload Process

Previously, the process took two people, one Chamber staff person and the web (technology) person, and four steps, and, would take about 1/2 day to complete due to schedules. Due to the human intervention required, it was run/done only once per month.

The Chamber staff person would extract member information from the in-house chamber management software into a tab-delimited text file, then email the file to the web person.

When the web person received the file in email, the file was download to the desktop and tested for being ‘text-only’ and ‘tab-delimited’. If it did not pass those two tests, an email was sent to the Chamber contact and a new extract file was created and sent to the web person, and the test was run again.

membership upload text file

Once the correct file format was determined, the file was manually edited in order to eliminate quotes and other extraneous text. The file was then uploaded to the Chamber’s website via FTP along with a specially-written upload PHP program. The upload program was run. Then the web person would test for success by using the Find a Member program on the Chamber’s website. When all was working as desired, the specially written PHP program was deleted from the directory, and the Chamber was notified of the successful update.

New Membership Upload Process

The new Membership Upload process requires one person, a Chamber staff member, and 1-2-3 easy steps. The staff person clicks a button (a saved macro) in the chamber management software that extracts the information into a tab-delimited text file and saves it on their desktop. The person logs into WordPress and clicks the Upload Member Info button on the Dashboard. The progress of the upload displays to them on the screen, and they can print the screen for their future reference. Done. The PHP membership upload program manages all the manipulation and editing that was previously completed manually .

After completing the project, all of the Chamber’s business goals have been met, and Chamber personnel can upload membership information multiple times per day or not, as they choose.


CrossFit of Marlboro Contest Custom Programming

Sunday, December 15th, 2013

CrossFit of Marlboro, Marlborough MA held a contest entitled 100 Push Ups for 100 Days

Business Requirements:

  1. Allow members participating in the Push Ups contest to enter the number of push ups they complete each day
  2. Allow members to access their own push up tallies and no one else’s
  3. Display tally of participants’ progress on the public website


  1. Create a password-protected data entry screen to captures members’ push ups each day

    Password Protected contest data entry screen

    Password-protected contest data entry screen

  2. Use “Participants” table to manage privileges and shield other participant’s information
  3. Create a screen to display members’ progress (See Push Up Contest Progress ) so other participants and CrossFit of Marlboro members can monitor the progress and cheer for their comrades


  • The contest data entry screen is defined in a custom PHP program that is referenced in WordPress’ functions file.
  • The built-in WordPress password-protection mechanism was used to control access to the contest data entry screen.
  • Participants and privileges are stored in a custom table inside the WordPress database.
  • The contest tracking data is stored in a custom table inside the WordPress database.
  • The contest progress display screen is a custom php program, also referenced via the functions file.