php多选题(php多选题代码)
华为云服务器特价优惠火热进行中! 2核2G2兆仅需 38 元;4核4G3兆仅需 79 元。购买时间越长越优惠!更多配置及优惠价格请咨询客服。
合作流程: |
本篇文章给大家谈谈php多选题,以及php多选题代码对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
微信号:cloud7591如需了解更多,欢迎添加客服微信咨询。
复制微信号
本文目录一览:
- 1、php关于字符串的处理(考试多选题),有点难
- 2、php做一个在线考试系统 不是很会做多选题 希望大神能提供帮助 如何做多选题 和多选题的数据库
- 3、PHP程序题:编写回答多项选择题的php程序,具体要求如下图
- 4、Php随机的20个单选题,多选题和判断题如何获取答题者的答案
php关于字符串的处理(考试多选题),有点难
!doctype html
html
head
meta charset="UTF-8"
titleUntitled Document/title
/head
form action="" method="post"
正确答案:input type="text" name='answer'
答 案 :input type="text" name="stuanswer"
input type="submit" value="比较答案"
/form
?php
if(isset($_POST['answer'])isset($_POST['stuanswer'])$_POST['answer']!=''$_POST['stuanswer']!=''){
$str=$_POST['answer'];
$str1=$_POST['stuanswer'];
if(strlen($str1)==strlen($str)){
$count=strlen($str);
for($i=0;$i$count;$i++){
if(!strstr($str1,$str[$i])||!strstr($str,$str1[$i])){
echo "script alert('答案错误');/script";
exit;
}
}echo "script alert('答案正确');/script";
}else{
echo "script alert('答案错误');/script";
}
}
?
body
/body
/html
//来试试这个代码,正则我不会,只能写这样的代码,你可以测试,我测试结果没有问题
php做一个在线考试系统 不是很会做多选题 希望大神能提供帮助 如何做多选题 和多选题的数据库
给你举个栗子吧,应该能看懂,
这是html:
form action="./test.php" method="post"
你喜欢什么语言?
br
input type="checkbox" name="yuyan[]" value="php"phpnbsp;nbsp;
input type="checkbox" name="yuyan[]" value="java"javanbsp;nbsp;
input type="checkbox" name="yuyan[]" value=".net".netnbsp;nbsp;
input type="checkbox" name="yuyan[]" value="js"jsnbsp;nbsp;
br
input type="submit" value="submit"
/form
前端效果:
这是php:
?php
$yuyan = $_POST['yuyan'];
echo 'pre';
var_dump($yuyan);
php接收数据后输出效果:
PHP程序题:编写回答多项选择题的php程序,具体要求如下图
就帮你写一下好了 我的php文件名称是test.php 你可以改成自己的php文件名称 好像是4zuoy2.php
!DOCTYPE html
html lang="zh-cn"
head
meta charset="UTF-8" /
title测试/title
/head
body
form action="test.php" type="post"
div class="select-area"
input type="checkbox" name="program[]" value="1" /AJAX
input type="checkbox" name="program[]" value="2" /PHP
input type="checkbox" name="program[]" value="3" /FLASH
input type="checkbox" name="program[]" value="4" /ASP
input type="checkbox" name="program[]" value="5" /JSP
/div
div class="submit-button"
input type="submit" class="submit"确定/button
/div
/form
/body
/html
?php
!empty($_POST['program']) ? $program = $_POST['program'] : '';
if ($program) {
//遍历传递过来的是数组
if (in_array(2, $program)in_array(4,$program)in_array(5,$program)) {
echo '正确';
}elseif (!in_array(2, $program) || !in_array(4,$program) || !in_array(5,$program)) {
echo '回答不全!';
}else{
echo '错误!';
}
}
?

Php随机的20个单选题,多选题和判断题如何获取答题者的答案
题目随机抽取,在表单里记录题目的id号,比如 input 的name 是qu_34,就表示题目id是34,php就可以通过对post的下标的获取,得出题目id为34,和数据库对比,得到答案是否正确
关于php多选题和php多选题代码的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
