如何用php制作可以计算结果并显示给用户的表格

时间:2019-05-04 08:53:40

标签: php

我必须制作一个表格,在每行中显示要问的问题。答案将是三列单选按钮,分别表示该人的身体类型,如vata,pitta和kapha身体类型(按印度草药)。 如果这些问题大约有15行,用户需要从vata,pitta或kapha列中进行选择,我如何向用户显示结果,使他能够看到每列的总和,并基于我可以建议的总和最高和第二高的人的身体类型。 我尝试为此使用Google表单,但没有成功。 我认为可以使用php完成此操作,但是我是一个初学者。因此,你们的一些帮助将是巨大的。 表格如下。

<form method='post' action='' id=''>
     <div class="quiz-form-body">
<div class="row">
<ul>
<li class="quiz-heading">Frame</li>
<li class="quiz-option"><input id="1" class="frame-radio" type="radio" name="frame-radio" value="vata" /><label for="1">I am thin, lanky, and slender with prominent joints and thin muscles.</label></li>
<li class="quiz-option"><input id="2" class="frame-radio" type="radio" name="frame-radio" value="pitta" /><label for="2">I have a medium, symmetrical build with good muscle development.</label></li>
<li class="quiz-option"><input id="3" class="frame-radio" type="radio" name="frame-radio" value="kippa" /><label for="3">I have a large, round or stocky build. My frame is broad, stout or thick.</label></li>
</ul>
</div>
<div class="row">
<ul>
<li class="quiz-heading">Weight</li>
<li class="quiz-option"><input id="4" class="wieght-radio" type="radio" name="wieght-radio" value="vata" /><label for="4">Low; I may forget to eat or have a tendency to lose weight.</label></li>
<li class="quiz-option"><input id="5" class="wieght-radio" type="radio" name="wieght-radio" value="pitta" /><label for="5">Moderate; it is easy for me to gain or lose weight if I put my mind to it.</label></li>
<li class="quiz-option"><input id="6" class="wieght-radio" type="radio" name="wieght-radio" value="kipp" /><label for="6">Heavy; I gain weight easily and have difficulty losing it.</label></li>
</ul>
</div>
<div class="row">
<ul>
<li class="quiz-heading">Eyes</li>
<li class="quiz-option"><input id="7" class="eyes-radio" type="radio" name="eyes-radio" value="vata" /><label for="7">My eyes are small and active.</label></li>
<li class="quiz-option"><input id="8" class="eyes-radio" type="radio" name="eyes-radio" value="pitta" /><label for="8">I have a penetrating gaze.</label></li>
<li class="quiz-option"><input id="9" class="eyes-radio" type="radio" name="eyes-radio" value="kippa" /><label for="9">I have large pleasant eyes.</label></li>
</ul>
</div>
<div class="row">
<ul>
<li class="quiz-heading">Complexion</li>
<li class="quiz-option"><input id="10" class="complexion-radio" type="radio" name="complexion-radio" value="vata" /><label for="10">My skin is dry, rough or thin.</label></li>
<li class="quiz-option"><input id="11" class="complexion-radio" type="radio" name="complexion-radio" value="pitta" /><label for="11">My skin is warm, reddish in color and prone to irritation.</label></li>
<li class="quiz-option"><input id="12" class="complexion-radio" type="radio" name="complexion-radio" value="kippa" /><label for="12">My skin is, thick, moist, and smooth.</label></li>
</ul>
</div>
<div class="row">
<ul>
<li class="quiz-heading">Hair</li>
<li class="quiz-option"><input id="13" class="hair-radio" type="radio" name="hair-radio" value="vata" /><label for="13">My hair is dry, brittle or frizzy.</label></li>
<li class="quiz-option"><input id="14" class="hair-radio" type="radio" name="hair-radio" value="pitta" /><label for="14">My hair is fine with a tendency towards early thinning or graying.</label></li>
<li class="quiz-option"><input id="15" class="hair-radio" type="radio" name="hair-radio" value="kippa" /><label for="15">I have abundant, thick and oily hair.</label></li>
</ul>
</div>
<div class="row">
<ul>
<li class="quiz-heading">Joints</li>
<li class="quiz-option"><input id="16" class="joints-radio" type="radio" name="joints-radio" value="vata" /><label for="16">My joints are thin and prominent and have a tendency to crack.</label></li>
<li class="quiz-option"><input id="17" class="joints-radio" type="radio" name="joints-radio" value="pitta" /><label for="17">My joints are loose and flexible.</label></li>
<li class="quiz-option"><input id="18" class="joints-radio" type="radio" name="joints-radio" value="kippa" /><label for="18">My joints are large, well knit and padded.</label></li>
</ul>
</div>
<div class="row">
<ul>
<li class="quiz-heading">Sleep Pattern</li>
<li class="quiz-option"><input id="19" class="sleep-radio" type="radio" name="sleep-radio" value="vata" /><label for="19">I am a light sleeper with a tendency to awaken easily.</label></li>
<li class="quiz-option"><input id="20" class="sleep-radio" type="radio" name="sleep-radio" value="pitta" /><label for="20">I am a moderately sound sleeper, usually needing less than eight hours to feel rested.</label></li>
<li class="quiz-option"><input id="21" class="sleep-radio" type="radio" name="sleep-radio" value="kippa" /><label for="21">My sleep is deep and long. I tend to awaken slowly in the morning.</label></li>
</ul>
</div>
<div class="row">
<ul>
<li class="quiz-heading">Body Temperature</li>
<li class="quiz-option"><input id="22" class="body-radio" type="radio" name="body-radio" value="vata" /><label for="22">My hands and feet are usually cold and I prefer warm environments.</label></li>
<li class="quiz-option"><input id="23" class="body-radio" type="radio" name="body-radio" value="pitta" /><label for="23">I am usually warm, regardless of the season, and prefer cooler environments.</label></li>
<li class="quiz-option"><input id="24" class="body-radio" type="radio" name="body-radio" value="kippa" /><label for="24">I am adaptable to most temperatures but do not like cold, wet days.</label></li>
</ul>
</div>
<div class="row">
<ul>
<li class="quiz-heading">Temperament</li>
<li class="quiz-option"><input id="25" class="temprament-radio" type="radio" name="temprament-radio" value="vata" /><label for="25">I am lively and enthusiastic by nature. I like to change.</label></li>
<li class="quiz-option"><input id="26" class="temprament-radio" type="radio" name="temprament-radio" value="pitta" /><label for="26">I am purposeful and intense. I like to convince.</label></li>
<li class="quiz-option"><input id="27" class="temprament-radio" type="radio" name="temprament-radio" value="kippa" /><label for="27">I am easy going and accepting. I like to support.</label></li>
</ul>
</div>
<div class="row">
<ul>
<li class="quiz-heading">Under Stress</li>
<li class="quiz-option"><input id="28" class="stress-radio" type="radio" name="stress-radio" value="vata" /><label for="28">I become anxious and/or worried.</label></li>
<li class="quiz-option"><input id="29" class="stress-radio" type="radio" name="stress-radio" value="pitta" /><label for="29">I become irritable and/or aggressive.</label></li>
<li class="quiz-option"><input id="30" class="stress-radio" type="radio" name="stress-radio" value="kippa" /><label for="30">I become withdrawn and/or reclusive.</label></li>
</ul>
</div>
</div>
<div class="submit-quiz"><input class="register-email" type="submit" name="submit_quiz" value="Submit Quiz" /></div> 

     <div class="bellow-button-box-p">
      <div class="bellow-button-box">
        <p class='text-abovebtn discoverp1bold'>    Ready to find out what your dosha is? Simply enter your email address to reveal your unique mind-body type and learn how to create a lifestyle that supports your dosha.
        </p>
        <p class='register-emailsection'><input type='text' class='quiz-email  required-entry validate-email' name='quiz-email'><input type='submit' class='register-email' value='Take me to my Results'></p>


    </div>
    </div>
     </form>

结果应根据每列中的答案显示Vata Pitta类型或Vata Kapha类型或Kapha Pitta类型,Vata或Pitta或Kapha类型。 这意味着,如果vata列的最大选择数不多,而pitta位居第二,则将类型显示为“ Vata Pitta身体类型”。 另外,如果Vata等于或大于50%,则显示Display Vata,依此类推;如果所有三个值都相等或几乎相等,则如何显示Vata,Pitta和Kapha身体类型

0 个答案:

没有答案