Creating a custom spiritual gifts assessment questionnaire

Okay, we’re back for another fun and exciting week of CCB tutorials.

Today, we’re picking up where we last left off: spiritual gifts assessment software.

Using my prophetic gifting, I sense you’re about to bolt me, so don’t bolt on me just yet. 😉

We’re not going to discuss how to qualify a spiritual gifting assessment, but I will teach you how to create a simple spiritual gifts assessment questionnaire form using an excel spreadsheet.

Of course, you could use a database (highly recommended), but I’d rather not get too complicated for those of us that are technically challenged.

Oh before I forget, I’m ONLY cover the following today:

  • Creating a php form
  • Creating excel spreadsheet of spiritual gift questions and CCB spiritual gifts key
  • Parse excel spreadsheet to display questions

We WON’T cover submitting, validating, storing and keying responses for each individual questionnaire submitted by users.

We’ll cover aforementioned topics in detail in the coming week or so. Okay, let’s get rolling with today’s tutorial.

Setting Up Your PHP Form

Let’s start with the easy step first which is creating a simple HTML5 form.

This form won’t be as glamorous as a CCB, Typeform or Wufoo form, but it’ll get the job done for this tutorial.

In the coming weeks, I’ll show you how to use Typeform and Wufoo for a more elegant user experience.

Nevertheless, I’ve provided the necessary form details, instructions/guide and code below for you to copy and tweak as you desire.

Creating the question and key excel spreadsheet

Yeah, yeah… I know that most techies wouldn’t consider using an excel spreadsheet the most efficient manner to create a questionnaire and key.

Again, I don’t recommend it for long term use as a database provides more flexibility and scale than does an excel spreadsheet.

But for the sake of this tutorial and making it more friendly for our non-tech users, excel spreadsheet it is. 🙂

Open excel spreadsheet, save it as question-key.csv, and create two columns: Question and Category.

Type one question per row in the question column, and using CCB’s Spiritual Gifts list, type in a category for each question. Read this tutorial to retrieve a list of CCB Spiritual gifts.

This binding of question and category will be used in the coming weeks to group and display how a person scored on the assessment.

Download Example Question-Key.csv File

Parsing excel spreadsheet to display form questions

Okay, were not ready to parse, add and display form questions using a bit of PHP magic.

At the very top of your form, add in the following line of PHP code:

To make things simple and easy to find, we’ll make use of functions. I’ll cover the functions prepareQuestions and outputQuestions at the very end of this tutorial.

Now that you have defined the formFieldData variable and set it equal to prepareQuestions, you’re ready to place the following line of code just about the form submit button as shown below:

And that’s it! You’ve now respectively parsed, captured and displayed each form question and input.

Time to test your PHP parsing prowess

By now, you’re code should look like the code shown below.

Save your php form and the question-key.csv in the same directory, and load the php form via a web browser to be wowed by your PHP prowess.

Although we’ve tailored this particular tutorial to focus on spiritual gifts assessment, you could easily change the questions and response choice text to account for a variety of opinion or scaled-based question and answer surveys.

Again, I recommend using a database, but this is a simple and fast method to create a reusable form using an excel spreadsheet to host your questions and key.

That’s it for today! Next week, we’ll cover the following in great detail:

  • Submitting and validating form data
  • Excluding certain questions based on key category
  • Summing, grouping and storing the results via an excel spreadsheet

If you have questions, please don’t hesitate to drop me a comment below. See you next week.

prepareQuestions Function

The prepareQuestions function simply reads the question-key.csv file to retrieve the question and question number data to pass along to the outputQuestion function for html placement.

Read this tutorial to learn and receive the inside scoop on how to parse an excel/csv file using php.

outputQuestion Function

The outputQuestion function simply prepares the html and form elements using the data output of the question and question number data from the prepareQuestions function.


Please comment if this tutorial has helped you.