PHP Questionnaire/Survey

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sillywilly
Forum Newbie
Posts: 19
Joined: Thu May 02, 2002 5:11 pm

PHP Questionnaire/Survey

Post by sillywilly »

I would like some help from some of you PHP experts.

This is the situation:

I would like to create an online questionnaire/survey that collects information about peoples gaming habits.

I have a paper version of this questionnaire, the questionnaire is broken down into sections (Section 1, 2, ...). Each section has a list of questions.

I would like to be able to create an online version using multiple forms. Once one section is filled out I would like the person to be taken to the next section. Thus only one section needs to be displayed at a time. It would be nice if I could have all the questions/sections in one PHP script, that only displays one section at a time without the need to open a new page(window) or be taken to a new php script.

I will need form information to be passed from form to form so that on the finial section the write to the database can occur.

If someone could give me an example of the coding involved or offer me any help then I would be extremely thankful.
PS The next question/section displayed will sometimes depend on the users input, for example if they state no to the question "Do you play games" then I would like to skip all the other questions and be taken to the finial section or indeed any section of my choice.

Kindest Regards

Andi
andrew@lanenuff.com
User avatar
sam
Forum Contributor
Posts: 217
Joined: Thu Apr 18, 2002 11:11 pm
Location: Northern California
Contact:

Post by sam »

That sounds like a rather tall order... If you get some of the basic design ideas together and post a little more information we might be able to help...

We mostly stick to helping people with code problems or suggestions, having someone design and implement code for you isn't alway the best way to learn. Sorry to disapoint.

Cheers Sam
sillywilly
Forum Newbie
Posts: 19
Joined: Thu May 02, 2002 5:11 pm

Post by sillywilly »

I was only looking for a helping hand as it where.

I was thinking along the lines of:

switch ($_POST['stage']) {
case "2":
// second page here
break;
case "3":
// third page here
break;
case "done":
// info into database
break;
default:
// first page here
}


Or:

if (!isset($HTTP_POST_VARS['stage'])) {

// Show first page

} else if ($HTTP_POST_VARS['stage'] == "2") {

// Show second page

} else if ($HTTP_POST_VARS['stage'] == "3") {

// Show third page

} else if ($HTTP_POST_VARS['stage'] == "done") {

// insert information into database

};


What do you think would be the best solution?

I'll post more information soon....
User avatar
sam
Forum Contributor
Posts: 217
Joined: Thu Apr 18, 2002 11:11 pm
Location: Northern California
Contact:

Post by sam »

I would go with the switch code... It works a little smoother and is more delightful to look at...

Cheers Sam :mrgreen:
luckypro123
Forum Newbie
Posts: 2
Joined: Tue Sep 21, 2010 4:47 am

Re: PHP Questionnaire/Survey

Post by luckypro123 »

hi, you can try create your code servey at http://www.phptutorial.info/scripts/mul ... /index.php
Post Reply