针对各种类别问题的单选按钮评分系统,并在末尾添加分数
我有一个 php 页面,上面有一些 HTML 问题,每个问题都有一个“类型”,您以 1-5 的范围回答该问题,在下面的示例中将有 3 种问题类型:A、B 和 & ; C. 如何添加每个问题“类型”的总分(分数由每个问题下方 1-5 级的单选按钮得出),然后将这些总分存储为 PHP 变量?
这是 HTML 代码,我不知道从哪里开始,但我需要为我们即将举办的学校活动制作这个,我不想让他们失望:) 哈哈!感谢大家的帮助,抱歉我对 HTML 表单知之甚少!无论如何,这是 HTML 代码,php 可以去任何我还没有写的地方/:哈哈:
Type A rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
Type B rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
Type A rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
Type C rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
Type A rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
Type B rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
Type B rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
<input type="submit" name="Sum The Ratings" value="Vote">
I have a php page that has a few HTML questions on it, each question has a "type" and you answer that question on a scale of 1-5, In the example below there would be 3 question types: A, B, & C. How can I add the TOTAL score for each question "type"(score is made from the radio buttons for the 1-5 scale below each question) and then have those total scores stored as PHP variables?
Here is the HTML code, I have NO CLUE where to start but I need to make this for a school event we are doing soon and I don't wanna let them down :) Haha! Thanks for all the help guys, sorry I know so little about HTML forms! Anyways, here's the HTML code, the php can go anywhere I haven't written it yet /: haha:
Type A rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
Type B rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
Type A rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
Type C rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
Type A rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
Type B rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
Type B rating:
<br>
<form action="" method="post">
1
<input type="radio" name="select" value="1">
<input type="radio" name="select" value="2">
<input type="radio" name="select" value="3">
<input type="radio" name="select" value="4">
<input type="radio" name="select" value="5">
5
</form>
<br><br>
<input type="submit" name="Sum The Ratings" value="Vote">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建一个包含所有问题的大表单,然后对于每个问题,使用每个问题不同的关键字设置输入名称。当你处理你的表单时,你将得到 $_POST['name'] 所选的值,只需添加它们并进行口粮或任何你想要的东西
我有明确的名称 cat_a 和 cat_b 但你可以把你所有的猫在一个数组中,然后循环进入它,在这个循环中,当有问题时循环,然后循环获取 5 个答案
Create a big form with all the questions in it, then for each question, set the name of the input with a keyword different for each questions. When you will treat your form, you will get with $_POST['name'] the value selected, just add them and make a ration or wathever you wan't
There i have explicitely name cat_a and cat_b but you can put all your cat in an array, then you loop into it, in this loop, you loop while ther is questions, and then you loop for the 5 answers