Results 1 to 4 of 4

Thread: Correct Answer in Radio Button

  1. #1
    Join Date
    Jul 2012

    Correct Answer in Radio Button

    The structure of the form is
    Question textbox
    Choice 1 textbox radiobutton 1
    Choice 2 textbox radiobutton 2
    Choice 3 textbox radiobutton 3
    choice 4 textbox radiobutton 4
    and save button


    Question - What is the capital of India?
    and its choices are
    Choice 1- SriLanka
    Choice 2- India
    Choice 3- NewYork
    Choice 4- London

    the correct answer is india and its id is 2

    After inserting the data in three table it will look

    qid Question
    1 What is the capital of India?

    ansid qid Choice
    1 1 SriLanka
    2 1 India
    3 1 NewYork
    4 1 London


    aid qid ansid
    1 1 2

    Now my problem how to show the correct answer through radio button corresponding
    the answer choice.
    for above example the radiobutton 2 will be checked true
    but it is possible to show the correct answer through radio button and then add 1 Value in Result Database


  2. #2
    Join Date
    Jun 2012
    Dark Side of the Moon
    I see a couple of options here, ASP is server side, so you are gonna run into the issue of either reloading the page, or having you answer somewhere in the code. If you are going the reload path, then you just need to have the user submit the form, either when they click the radio or with a button, something like:

    <form method=post action=checkanswer.asp name=question><input type=radio name=answer1 onclick=document.question.submit()></form>
    Or you can go the javascript route, and put the answer in the page with:

    content = "<script language=javascript> function CheckAnswer(a){
    if(a == 2){ alert("You are correct"); }
    Now its not all that simple, you have to work out the details, but that is gist of it. If you are testing people for some other reason than fun, I would go the ASP route and load a result page with something like "Yeah your correct" or "Nope try again", or however you want to put it to them. The ASP route just means you can't open the source of the page and cheat. There are a few other, more complicated ways to do this with java, but why when all it costs you is page load. Post up if you need more help.

  3. #3
    Join Date
    Jul 2012

    dear i want it in ASP.Net

    actually i am using visual studion 2008 and there i am building an online examination system for that i am using this, and there im also using Database so pls guid me in that point of VIEW

  4. #4
    Join Date
    Jun 2012
    Dark Side of the Moon
    Try posting it up in the .NET forum then aye, can't read minds, just posts in the ASP forum.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center