473,396 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Make a Quiz with multiple answers.

nomad
664 Expert 512MB
I have a general question on how to select multiple question on a quiz.

The quiz is done in html and php, with a post method.
The post info connect to a php file. By the way the the guess are A, B, C, D...

This is part of my code for the multiple question to see if its the aswer is correct or not.

Here I made the A, B, C, D in answers1.1, answers1.2, answers1.3, answers1.4.

Here is part of my code

Your answer was: [PHP]<?php
if ($question2 == "answer2.1")
{
echo ("<b>Correct</b>");
$score = $score + 1;
}
else
{
echo ("<b>Incorrect</b>");
}
?>[/PHP]

Part I need help is here
if ($question2 == "answer2.1")


How do I get to to read multiple answers.
is it like this
[PHP] if ($question2 == "answer2.1"
$$ "answer2.3")
[/PHP]

or this
[PHP] if ($question2 == "answer2.1" $$ $question2 == "answer2.3")
[/PHP]

Both answers have to be selected in order to get the question right.



thanks
nomad
Mar 21 '08 #1
6 3117
Markus
6,050 Expert 4TB
Dont understand why youre using the dollar sign.
You have multiple answers? So you want an OR clause (||)

[php]
if(($this == 11) || ($this == 12))
[/php]

Regards
Mar 21 '08 #2
nomad
664 Expert 512MB
Dont understand why youre using the dollar sign.
You have multiple answers? So you want an OR clause (||)

[php]
if(($this == 11) || ($this == 12))
[/php]

Regards
Thanks Markusn00b
but will the OR be correct.
sounds like I can have either answer and I will be right. I need both to be chosen to be right.

Just asking????
damon
Mar 21 '08 #3
Markus
6,050 Expert 4TB
Thanks Markusn00b
but will the OR be correct.
sounds like I can have either answer and I will be right. I need both to be chosen to be right.

damon
Oh i see!
Sorry.
Ok, in thatcase use the AND operator (&&)
[php]
if(($this == 11) && ($this == 14))
[/php]

Regards!
Mar 21 '08 #4
nomad
664 Expert 512MB
Oh i see!
Sorry.
Ok, in thatcase use the AND operator (&&)
[php]
if(($this == 11) && ($this == 14))
[/php]

Regards!
That's what I thougth
Thanks Markus...
Mar 21 '08 #5
Markus
6,050 Expert 4TB
That's what I thougth
Thanks Markus...
Welcome!

Regards, markus.
Mar 21 '08 #6
nomad
664 Expert 512MB
Back to the quiz.
I transfer my files to a Mac and now I'm having problems making php work.
Im using DreamWeaver and XAMPP (XAMPP is working).
When I publish a file in HTML/php in Dreamweaver I get an error
File not found or could not be created.

The quiz is in two parts.
The quiz itself is written in a html/php using forum ie post method.
the other part is written in php this has the results and the correct answers.

The test server is located at xampp\htdocs\
I know that on the PC side you need to modify a couple of files which I can not remember which ones or what to add to it.
I tried going to the forums on XAMPP but there is no info for the mac that is related to this issue. On the PC side there are to many topics to read.

Anyway I hope someone can help me or direct me where I can find this info,

thanks
nomad
Mar 24 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: C. David Rossen | last post by:
Hello: I found a script for a simple multiple choice quiz that I would like to tailor to a quiz that I want to post on a website. The quiz I want to use can be found at : ...
17
by: rgoya | last post by:
Peace be with you! About a year ago, I created a JavaScript which turns any web site into an online anti-war protest: http://www.geocities.com/rgoya/javascript/PROTEST.HTM I have recently...
1
by: Mohammed Mazid | last post by:
Basically I want to store the answer of a single-choice question (where candidate selects one answer) and multiple-choice question (where candidate selects more than one answer). I would like to...
10
by: WindAndWaves | last post by:
Dear All I am making a quiz with a four-option-multiple-choice scenario. When you enter the quiz, you provide one answer and three wrong answers. Then the contestant opens the quiz and I...
11
by: admin | last post by:
Hi all, First time poster here... I'm a webmaster and I'd like to add a simple script to my website which will allow users to fill in a brief multiple choice questionaire, and then provide a...
0
NoPeasHear
by: NoPeasHear | last post by:
I don't know what I am doing wrong... I used this tutorial... http://www.permadi.com/tutorial/flashMXQuiz/index.html It works with their quiz.xml file, but when I add an option for multiple...
1
by: stevenjs | last post by:
Greeings, all, Flash 8 has quiz templates which are coded for multiple choice, true/false, text statement, and matching types of questions, along with hotspots and probably anoher type I am...
1
by: korr | last post by:
Hi there, i'm trying to develop a quiz in flash. Searching on the net, I found a quiz in flashkit from sephiroth.it by Alessandro Crugnola. His quiz has a script that puts the questions and the...
3
by: empiresolutions | last post by:
I making a personality quiz that goes like the following. User takes a test to determine which type of person they are more like. So there will be say 5 types, each given a percentage of 100 that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.