Page 1 of 1

Quiz

Posted: Sat Jan 03, 2004 8:00 am
by ali
Hey all.I'm going to put a quiz sort of thing on my website but I don't know PHP so I can't create a script for it.I want to have a script that manipulates the answers submitted by the user.It would add and subtract the user's score depending on wether the answer is correct or not.It would also display a rank for the user depending on his score.Here's the code of the form of the test:

Code: Select all

<FORM title="" action=score.php 

method=get><P> </P><P>1-You are chatting on IRC when you suddenly get a 

message from someone that tells you that your computer is infected with a 

virus and you must accept the file that person's sending you because it is 

the only patch that fixes the virus.What will you do?</P></P><P><INPUT 

type=radio value=a name=1><FONT color=#00008b> (a)Accept the file 

transfer and run the 

file.             

<INPUT type=radio value=b name=1>(b)Decline the File 

transfer           &nb

sp;    <INPUT type=radio value=c name=1>(c)Accept the file 

transfer and scan the file for 

viruses.           &nb

sp;            &n

bsp;  <INPUT type=radio value=d name=1>(d)Restart your 

computer           &nb

sp;            &n

bsp;     <INPUT type=radio CHECKED value=e 

name=1>(e)Too Technical</FONT></P><P>2-You find on Microsoft's website that a 

new security update is available.However they want you to download the 

file<FONT color=#ff0000>"patch203.exe"</FONT><FONT color=#000000>.What'll you 

do?</FONT></P><P><INPUT type=radio value=a name=2><FONT 

color=#a52a00>(a)Download and run the 

file         <INPUT type=radio 

value=b name=2>(b)Won't download the 

file.           <INPUT 

type=radio value=c name=2>(c)Download the file and scan it for 

viruses.</FONT></P><P><center><INPUT type=radio CHECKED value=d name=2><FONT 

color=#a52a00>(d)Too technical</center></FONT></P><P>3-Your computer suddenly 

starts acting funny.You keep deleting an entry from registry but it still 

keeps coming back.And you keep getting funny messages from your 

computer all the time.You will......</P><P><INPUT style="WIDTH: 20px; HEIGHT: 

20px" type=radio value=a name=3><FONT color=#00005e>(a)Scan your computer for 

viruses.           &nb

sp;      <INPUT type=radio value=b name=3>(b)Update 

your Anti Virus Software and scan your computer for 

viruses.            

<INPUT type=radio value=c name=3>(c)Scan your computer using both Anti Virus 

and Anti-Spyware programs.   <INPUT type=radio value=d 

name=3>(d)Ignore it. </FONT></P><P><FONT 

color=#00005e>          &nb

sp;            &n

bsp;            &

nbsp;            

             

;        <INPUT type=radio CHECKED value=f 

name=3>(f)Too technical</FONT></P><P>4-You get an email from one of your 

friends.The email tells you about a new and dangerous virus.And you are told 

to forward that email to everyone you know,and do not connect to the 

internet for the next 3 days because the virus will infect every computer 

thats connected to the internet for the next 3 days.Make a 

choice:</P><P><INPUT type=radio value=a name=4><FONT color=#804040>(a)I'll do 

exactly as instructed in the 

email.            

; <INPUT type=radio value=b name=4>(b)I'll forward the email to my buddies 

but will remain connected to the 

internet.          <INPUT 

type=radio value=c name=4>(c)I'll just laugh and say "Its a 

hoax."    <INPUT type=radio CHECKED value=d name=4>(d)Too 

technical.</FONT></P><P>5-You get an email with the subject "How to get 

anyone's hotmail password".The email asks you to send your password,the user 

id who's password you wish to get,and your user id to 

"retreive_pass_back@hotmail.com".What'll you do?</P><P><INPUT type=radio 

value=a name=5><FONT color=#00008b>(a)</FONT><FONT color=#00008b>Make use of 

this golden oppurtunity and immediately send all the required 

information.           

<INPUT type=radio value=b name=5>(b)Carry out option 1 3 times or 

more.            

   <INPUT type=radio value=c name=5>(c)Delete the 

email.            

;            &nbs

p;      <INPUT type=radio CHECKED value="d " 

name=5>(d)Too technical.</FONT></P><P>6-</P><h2>The rest of this test is 

under construction.Any ideas?Mail me at <a 

href="mailto:ideas@virustimes.cjb.net">ideas@virustimes.cjb.net</a><P><FONT 

color=#00005e></FONT> </P><P> </P><P> </P><P><FONT 

color=#00008b></FONT> </P><P><P> </P><P> </P><P> </P></FO

RM>
Correct Answers:

Here are the correct answers to the questions:

Q#1: (b)

Q#2: (a)

Q#3: (b)

Q#4: (c)

Q#5: (c)

Explanation of the code of the form:

As you can see in the form's code,the name of the radio buttons' series is the number of the question it is for.For example all the buttons of Question#1 are named 1.While all the values of the radio buttons are the alphabets they stand for.For example,the value of the button C of Q#1 would be c.


What I want the script to do:
I want to have a script named score.php.This script would add 20 marks to the score of the user if the answer is correct.If it isn't correct then it would subtract 20 marks from his score.If the user chooses the too technical option then it would do nothing to the score,that is,leave it as it is.And if the user scores 0-20 marks,he should be given a rank "Newbie." If he scores "20-80" then his rank would be "Intermediate." ANd if he scores "80-100" his rank would be "Guru".I'll set the HTML code of the script myself.I just want the code that would handle the score and rank generation.Can someone help me please?
Thanks a lot.
Ali.

Posted: Mon Jan 05, 2004 9:36 pm
by scorphus
Have you tried something yet? Did you search the web to see if there is already some sort of code that could fit your needs?
Dear twigletmac on http://forums.devnetwork.net/viewtopic.php?p=74162#74162 once wrote:You want to get the information from the form and process it using PHP? The best place to start would be with a tutorial - check out http://www.devshed.com and they should have something you can adapt.

This forum is intended to help people with code they have already written rather than to write code for them.

Mac
Alternatively you could post some thread on the Job Hunt forum or take a look at some job auctions site out there...

Regards,
Scorphus.

Posted: Thu Jan 08, 2004 7:06 am
by ali
hi there.Well actually I'm not into PHP programming at all.I find it too complicated.Therefore I'd really appreciate if someone would write down the script for me.Thanks!