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>