Hi everybody,

I am a total PHP newbie and I would like to build from scratch a survey form with radio buttons where visitors will have to make a choice.
Each choice will have to continue with a continue button.
for example
question 1
Are you diabetic? (radio button yes or no)
if no is selected, the survey ends and it displays a message eg.: Thanks you, this is ONLY for diabetics.
If yes is selscted, the survey proceeds and a new radio buttons pops up
Are you type 1 or type 2 diabetic?
if type 1 is selected the survey ends and it displays a message: Thanks you, this is only for type 2 diabetics.
If type 2 is selected the survey proceeds and a new radio buttons pops up
and so on and so on.

Does anybody know if there is an example of such a script from which I can learn from to develop my own.
Thanks

    there are both open source survey scripts ,and sites that let you create surveys on them.

      Thanks Dagon...
      Where can i find such an example to learn from?

      Thanks

        Here is my start (see code below)
        Please let me know if I am heading in the right direction on this. I am not there yet. Is this the right way to do it or is there a better way?
        What I would like to learn in this small project of mine is how to let each question remain on the page so that users can see the questions they have answered so far.
        When the survey is finished, I would like to have a summary of the questions asked with their respective answered show on one page and give the user the option to print it or email it to themselves for their own archive.
        All ideas and directions on this are very welcome.

        Thanks.
        <form action="" method="post">
        <input type="radio" name="diab" value="dyes"> Yes
        <input type="radio" name="diab" value="dno"> No<br />
        <input type="submit" name="submit" value="Continue"/>
        </form>
        <?php
        switch($_POST['diab']){
        case 'dyes':
        ?>
        Are you type 1 or 2
        <form action="" method="post">

        <input type="radio" name="diab" value="type1"> 1
        <input type="radio" name="diab" value="type2"> 2<br />
        <input type="submit" name="submit" value="Continue"/>
        </form>

        		 <?php		
           break;
           case 'dno':
           echo "Thank you. This is for diabetics only";
           }	
        
        
         ?>
        
                <?php		
            switch($_POST['diab']){
            case 'type2':
            ?>
        			Do you know your BMI?
           <form action="" method="post">

        <input type="radio" name="diab" value="bmiyes"> Yes
        <input type="radio" name="diab" value="bmino"> No<br />
        <input type="submit" name="submit" value="Maak uw keus"/>
        </form>
        <?php
        break;
        case 'type1':
        echo "Thanks you. This is for type 2 only";
        }

        		?>		
        	 <?php		
            switch($_POST['diab']){
            case 'bmiyes':
            ?>
        			Is your BMI above 25?
           <form action="" method="post">

        <input type="radio" name="diab" value="bmiabove"> Yes
        <input type="radio" name="diab" value="bmibelow"> No<br />
        <input type="submit" name="submit" value="Continue"/>
        </form>
        <?php
        break;
        case 'bmino':
        ?>
        To be continued?
        <form action="" method="post">
        <input type="radio" name="diab" value="bmicontyes"> Yes
        <input type="radio" name="diab" value="bmicontino"> No<br />
        <input type="submit" name="submit" value="Continue"/>
        </form>
        <?php
        break;
        case 'bmicontno':
        echo "Thanks you. This is for diabetics 2 only";
        }
        ?>

        </body>
        </html>

          Write a Reply...