473,818 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Make a Quiz with multiple answers.

nomad
664 Recognized Expert Contributor
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>Incorre ct</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 3156
Markus
6,050 Recognized Expert Expert
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 Recognized Expert Contributor
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 Recognized Expert Expert
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 Recognized Expert Contributor
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 Recognized Expert Expert
That's what I thougth
Thanks Markus...
Welcome!

Regards, markus.
Mar 21 '08 #6
nomad
664 Recognized Expert Contributor
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
9215
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 : http://mtl.math.uiuc.edu/users/C2Schult/quiz2.html Here is my problem. I want to be able to use answers with more than one word or number which requires spaces. When I tried doing that, it did not
17
2288
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 revamped the anti-war quotes quiz: http://www.geocities.com/rgoya/javascript/PROTCODE.HTM#usaquiz Please feel free to
1
1738
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 store it in a table and then when I run the quiz application on VB, I would like to track answers for both types of questions. Please help me solve this problem. Much appreciated.
10
1504
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 trying to present them the four answers on the page in a randomized way (i.e. you have no idea which one comes first).
11
3325
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 'thoughful' suggestion based on their answers. In terms of the logic involved with the actual script: I've mulled it over and thoroughly broken my brain, trying to devise a complicated 'scoring system' (with different answers giving different...
0
4585
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 correct answers, the results page always gives me a response of 0. What would I change from the tutorial to have multiple correct responses reflect in the results? <?xml version="1.0"?>
1
4465
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 forgetting. The test taker makes their selection(s) or answers, and clicks a "check answer" button. They then get a feedback statements depending on whether they have answered correctly or not. Many questions involve multiple selections to be correct, but...
1
3097
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 answers in random order. What i'm looking for is to not select the answers by clicking the mouse, but using the keyPress handler. Using the keyPress handler the script selects only the first answer I tried a lot but i didn't find any solution.. 2...
3
3178
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 they are closest to at quiz end. The test has 50 questions, plus a age question and a sex question. Each test has 5 possible answers. The user clicks through radio button to fill out the quiz. No sweat so far. My issue is in the test scoring, this...
0
9618
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10694
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10416
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10438
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10153
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6909
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5576
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5715
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3039
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.