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