Jump to content

Final Year Polytechnic Project (Editable Online Questionnaire)


SeroZero

Recommended Posts

Hi everyone, this is my first time in this forum and I really need to seek some help from much more experienced PHP coders.

 

My Final Year Project requires me to create a questionnaire to collect Profiling Data from the students. However with only half a year's experience with PHP coding, we find our knowledge rather insufficient at this point.

 

Currently we have created a simple questionnaire with a simple search engine [attached]

 

However now we have been requested to create a questionnaire where it is able to edit, add, remove questions from the questionnaire online itself without the need to go backend.

 

Looking at some tutorials and other posts on this forum, I realised that the "hardcoding" we did, by putting all the questions/answers in to the HTML code itself instead of pulling it out from the database in SQL will cause difficulties. Thus I have decided to build the whole survey from scratch where the questions and answers are all stored in the SQL database itself.

 

Help needed :

> How should I actually create my database? What is in my mind now is to create a database with tables as such:

 

Questionslist (Storing questions)

id, questionid, question

 

Answerslist (Storing options for questions male,female etc.)

id, questionid, option

 

> I currently have no clue how to start creating a page where I can add/edit/remove the questions in the questionnaire. Any example on how to start?

 

> I roughly have an idea on how to edit or remove the questions the questions, but how do I add a question with the choice of making it a TEXT option, or a RADIO BUTTON option or a LIST option and have it add that question into my table of questionlist and answerlist as well?

 

Currently using Adobe Dreamweaver CS5 and HeidiSQL for this project. We have requested a webspace from the school itself to host this questionnaire as well.

 

If anyone needs more infomation to be able to assist me, I would gladly provide.

 

With Thanks,

Shawn

 

[attachment deleted by admin]

Link to comment
Share on other sites

Questionslist (Storing questions)

id, questionid, question

That could work, but to expand the system, you would need a field with the question `category` too. (imagine you want only questions about animals, or computers) and the field `gender` if you're planning on having specific questions for males and others for females. Also, you do not need the field `questionid`, since the id will be created automatically for you in your primary key.

 

Answerslist (Storing options for questions male,female etc.)

id, questionid, option

Missing a few options here too, you'll need to add points to each question, or at the very least, flag the question that is the correct answer (I'm guessing this is a multiple choice questionaire, and this is where you store the possible answers from each user)

 

TABLE: `userAnswers`:: `id`,`questionid`,`answerid`, `username`,`date`,`time` (Always include date and time when the data stored is based on user input, you might not need it now, but I guarantee it will be useful in the future/*real world*, and before you know it you'll be adding this to almost all your tables)

 

> I currently have no clue how to start creating a page where I can add/edit/remove the questions in the questionnaire. Any example on how to start?

Think simple to start with, then you can add/change features. You basically want a text field to input a question, and another text field for each possible answer, along with a little checkbox so you can flag the correct answer (again, I'm presuming it's a multiple choice system). Basically, if you're adding stuff to the main tables in an administrator environment, you'll need to account for ALL the fields you have in your database (Except the primary key which is automatic) so you'll also need a category dropdown (in case you follow my example above to add categories) and a GENDER radio button, checkbox, or dropdown (any one will work, depends how you want to code/style it)

 

> I roughly have an idea on how to edit or remove the questions the questions, but how do I add a question with the choice of making it a TEXT option, or a RADIO BUTTON option or a LIST option and have it add that question into my table of questionlist and answerlist as well?

you post your form with all the fields filled in, and then you add it to the database in two steps:

STEP 1: add the question, category and gender.

STEP 2: use mysql_insert_id to grab the last inserted id and use that as your `questionid` in your `Answerslist` table when adding each answer.

 

hope this helps

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.