Forums
This topic is locked
online survey
Posted 27 Jul 2007 23:29:23
1
has voted
27 Jul 2007 23:29:23 chuck wagon posted:
I am trying to create an online survey here:yesayurveda.com/new/quiz.php
where checkboxes have the value of 1 and depending on which column total is greatest, you will be taken to an url with an explanation.
This is how I have the form set up:
<form action="" method="post" name="quiz" id="quiz">
Here's an example of the frame column:
<table width="540" border="0" cellpadding="0" bgcolor="ffffff" id="quiztable">
<td width="120" class="underlink">Frame</td>
<td width="24" class="quiz"><input name="vata" type="checkbox" value="1" onClick="this.form.vata.value='1';calculate();"></td>
<td width="113" class="quiz"> Thin</td>
<td width="24" class="quiz"><input name="pitta" type="checkbox" value="1" onClick="this.form.pitta.value='1';calculate();"></td>
<td width="104" class="quiz">Medium / Moderate</td>
<td width="24" class="quiz"><input name="kapha" type="checkbox" value="1" onClick="this.form.kaph.value='1';calculate();"></td>
<td width="94" class="quiz">Large / Heavy</td>
and I was trying something like this:
<script language="javascript">
function calculate() {
var v1, p1, k1
v1 = quiztable.vata.value * 1;
p1 = quiztable.pitta.value * 1;
k1 = quiztable.kapha.value * 1;
if (v1 > p1 && v1 > k1)
{value = "vata";}
if (p1 > v1 && p1 > k1)
{value = "pitta";}
if (k1 > p1 && k1 > v1)
{value = "kapha";}
}
</script>
but I am not having any luck. any help would be great.
Thanks.
Fitz