Hi guys,

Hope you're all well. I have managed to get the quiz that I have been working on to work now thank god!

I just want to show just 20 random questions from the 80 questions that I have in the question bank.

Looking at the quiz files I think this is where I need to make the changes
PHP Code:

<?php    

$msg = "";   
if(isset($_GET['msg'])){   
    $msg = $_GET['msg'];   
    $msg = strip_tags($msg);   
    $msg = addslashes($msg);   
}   
?>   
<!doctype html>   
<html lang="en">   
<head>   
<meta charset="utf-8">   
<title>Quiz Tut</title>   
<script>   
function startQuiz(url){   
    window.location = url;   
}   
</script>   
</head>   
<body>   
<?php echo $msg; ?>   
<h3>Click below when you are ready to start the quiz. This is a ramdom quiz so each time you take the quiz the questions will show in a different order each time!</h3>   
<button onClick="startQuiz('quiz.php?question=1')">Click Here To Begin</button>   
</body>   
</html>

I want to show 20 questions at random. I think this is the line of code that I need to do something with.

<button onClick="startQuiz('quiz.php?question=1')">Click Here To Begin</button>  

Any help would be much appreciated

Member Avatar for diafol

This looks a bit screwy. So the quiz depends on sending a question number to a php page. Why are you using javascript at all? If this is a workaround to use a button as a link, you're far better styling a link to look like a button.

hey i got the code from this webiste http://www.gotcode.org/. So there will be things that I will need to change to get it to work how I want it to work

Member Avatar for diafol

Ok if you.re using a third party script have you asked over on that site?

yes servral times and the person who created the code cannot be contacted. There are a number of people who are wanting to ask the person questions and they cannot get any responses

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.