data structure

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
rampant
Forum Newbie
Posts: 9
Joined: Thu Oct 08, 2009 2:28 pm

data structure

Post by rampant »

Ok, so I am trying to build something like an interactive application that works like a Q/A. The user is presented with information, and presented with a choice. When they choose, that choice is sent (ajax) to a php script that takes that choice and spits out more questions/options.

I want to build a generalizable solution, so that I can take that code and aim it at some sort of data source (DB, flat file, not sure) and use that data to create the interactive logic.

Thoughts on how to design the data source so that it holds logic (like, if user selects B, send them to the earlier slide/state).

I have never implemented something this complex before.
User avatar
JNettles
Forum Contributor
Posts: 228
Joined: Mon Oct 05, 2009 4:09 pm

Re: data structure

Post by JNettles »

This is going to be more of a javascript solution than a PHP one. You might use PHP to handle answering questions but I'd say a good part of your logic is going to be javascript. I recommend jQuery, personally.
rampant
Forum Newbie
Posts: 9
Joined: Thu Oct 08, 2009 2:28 pm

Re: data structure

Post by rampant »

JNettles wrote:This is going to be more of a javascript solution than a PHP one. You might use PHP to handle answering questions but I'd say a good part of your logic is going to be javascript. I recommend jQuery, personally.
I got that JS is involved, but I don't want too much on the client side. The reason for the Q/A thing is to be able to test users, so having the answers and such built in to the client side means users can cheat (with some skill at code).

jquery needs to send the answer/input to a php script. The php script needs to take the answer, and be aware of where in the test/sequence things are, and then do something competent with it.

I am trying to design this so that it is a general solution to question/response interactions so that I can re-use the application.
Post Reply