Jump to content

PHP Linear path


mrliam

Recommended Posts

I am trying to setup a data collection system which consists of 10 questions on 10 php pages but depending on the initial hyperlink selection I will not be asking all 10 questions.

 

e.g.

 

option 1 = Q1 -- Q2 -- Q3 -- Q4 -- Q5 -- Q6 -- Q7 -- Q8 -- Q9 -- Q10

option 2 = Q1 -- Q2 -- Q3 -- Q4 -- Q7 -- Q8 -- Q9 -- Q10

option 3 = Q1 -- Q2 -- Q5 -- Q6 -- Q7 -- Q8

option 4 = Q2 -- Q4 -- Q5 -- Q7 -- Q8 -- Q9 -- Q10

 

I have tried to call a function with a switch in it but I can't get it to work and I can't find any examples out there to learn from. I know this script below is not accurate but it may help you understand what I am trying to achieve.

 

<html>

<head>
	<title></title>
</head>
<body>
<script language="javascript" type="text/javascript">

function optionpath(opno) 
switch (opno)
{
case 1:
q1
q2
q3
q4
break;
case 2:
q1
q3
q5
q6
break;
default:
}
</script>

<p><input type="button" value="option1" onClick="optionpath(1);"></p>
<p><input type="button" value="option2" onClick="optionpath(2);"></p>
<p><input type="button" value="option3" onClick="optionpath(3);"></p>
</body>
</html>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/76451-php-linear-path/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.