1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Is there any test generator PHP script there?

Discussion in 'PHP' started by Fracisc, Jun 5, 2009.

  1. #1
    I need a script that will help me generate a test.
    I have a few questions and I must be able to add a few answers. People will choose their answer and after submit the script should send the report (correct vs wrong).
    Is there a script like this?
    Or do you know a place where I can get an idea on how to start coding it?
    Fracisc, Jun 5, 2009 IP
  2. TecBrat

    TecBrat Member

    Likes Received:
    Best Answers:
    Trophy Points:
    You could go as simple as a form and handler, or you could go as complex as an interactive database that lets you add new questions and answers as an administrator, remembers who gave what answers and does ranking or whatever you want.

    Sounds like you want the simpler solution. The first step is to make an HTML form that asks the questions. Use something like name=answer[] to put the answers in an array. The action of your Test form would be the handler (Use Post method).

    In the handler you would have an array of answers and access the visitors answers like:
    (Or replace the letters with whatever the correct answer would be.)

    Then you'd compare $answer[x] and $answer_key[x] to see if they match.
    Then you could echo the results or use the php mail() function to send yourself a report.
    TecBrat, Jun 5, 2009 IP
  3. Fracisc

    Fracisc Well-Known Member

    Likes Received:
    Best Answers:
    Trophy Points:
    I need to generate a random list of 10 questions, from a database. Those questions can have one or more correct answers. After they submit the form I want to return the number of the correct answers and highlight the errors.
    It is a bit more complex then what you have suggested.
    Do you have any idea how can I start coding what I need?
    Fracisc, Jun 5, 2009 IP
  4. Social.Network

    Social.Network Member

    Likes Received:
    Best Answers:
    Trophy Points:
    Social.Network, Jun 5, 2009 IP