本文给大家介绍如何使用jQuery+PHP+MySQL来实现在线测试题,包括动态读取题目,答题完毕后台评分,并返回答题结果。
读取答题列表:$sql = "select * from quiz order by id asc"; <br>
$query = mysql_query($sql); <br>
while ($row = mysql_fetch_array($query)) { <br>
$answers = explode('###', $row['answer']); <br>
$arr[] = array( <br>
'question' => $row['id'] . '、' . $row['question'], <br>
'answers' => $answers <br>
); <br>
} <br>
$json = json_encode($arr);
我们在#quiz-container生成答题列表:<div></div>
quiz插件调用:$(function(){ <br>
$('#quiz-container').jquizzy({ <br>
questions: <?php echo $json;?>, //试题信息 <br>
sendResultsURL: 'data.php' //结果处理地址 <br>
}); <br>
});
答题演示地址:http://www.sucaihuo.com/php/113.html
AD:真正免费,域名+虚机+企业邮箱=0元

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver CS6
Visual web development tools