Skip to main content
Known Participant
May 11, 2017
Answered

How to make an online quiz email results?

  • May 11, 2017
  • 3 replies
  • 5319 views

Hello,

I have created an online quiz using some very basic html code and a basic script to make it work. The quiz will not be online but rather used internally for training. I was wondering if anyone could offer some pointers for how I can make the results submittable via email? I have pasted an example of my code below. Can anyone tell me where I'm going wrong or offer a solution for me to get it to work?

<!DOCTYPE HTML>

<html>

<head>

    <title>ISO 9001:2015 Internal Auditor Quiz</title>

</head>

<body>

       <form name="quiz">

    <p>

        <b>Question 1.

        <br>A root cause of a nonconformance is defined as a problem that?<br></b>

<blockquote>

<input type="radio" name="q1" value="a"id="q1a"><label for="q1a">is discovered by conducting designed experiments<br>

<input type="radio" name="q1" value="b"id="q1b"><label for="q1b">is established through the use of fishbone diagrams<br>

<input type="radio" name="q1" value="c"id="q1c"><label for="q1c">must be reviewed by the material review board<br>

<input type="radio" name="q1" value="d"id="q1d"><label for="q1d">must be corrected in order to prevent a recurrence<br>

</blockquote>

<p><b>

<hr>

Question 2.

<br>When lower-tier documents are compared to higher-tier documents before the fieldwork starts, the comparison is called a<br></b>

<blockquote>

<input type="radio" name="q2" value="a"id="q2a"><label for="q2a">desk audit<br>

<input type="radio" name="q2" value="b"id="q2b"><label for="q2b">process audit<br>

<input type="radio" name="q2" value="c"id="q2c"><label for="q2c">conformance audit<br>

<input type="radio" name="q2" value="d"id="q2d"><label for="q2d">management audit<br>

</blockquote>

<p><b>

<hr>

Question 3.

<br>An audit trail is necessary in order to<br></b>

<blockquote>

<input type="radio" name="q3" value="a"id="q3a"><label for="q3a">schedule and budget for audit assignments<br>

<input type="radio" name="q3" value="b"id="q3b"><label for="q3b">show how and when items were reviewed<br>

<input type="radio" name="q3" value="c"id="q3c"><label for="q3c">provide management with justification for an audit<br>

<input type="radio" name="q3" value="d"id="q3d"><label for="q3d"> provide the audit manager with audit results<br>

</blockquote>

<p><b>

<hr>

Question 4.

<br>Which of the following audit strategies is a common technique to assess compliance to a specific requirement at all locations where that requirement is applicable?<br></b>

<blockquote>

<input type="radio" name="q4" value="a"id="q4a"><label for="q4a">Discovery method<br>

<input type="radio" name="q4" value="b"id="q4b"><label for="q4b">Element method<br>

<input type="radio" name="q4" value="c"id="q4c"><label for="q4c">Department method<br>

<input type="radio" name="q4" value="d"id="q4d"><label for="q4d">Process method<br>

</blockquote>

<p><b>

<hr>

<input type="button"value="Grade Me"onClick="getScore(this.form);">

<input type="reset" value="Clear"><p>

Number of score out of 15 = <input type= text size 15 name= "mark">

Score in percentage = <input type=text size=15 name="percentage"><br>

</form>

<p>

    <form method="post" name="Form" onsubmit="send" action="mailto:me@mymail.com" input type=text name="percentage">

   <input type=text name="percentage">

<input type="submit" value="Submit results">

</form>

</body>

Correct answer Jon Fritz

<!DOCTYPE HTML>

<html>

<head>

    <title>Quiz</title>

</head>

<body>

    <center><h1>Quiz</h1></center>

    <p>

    <form name="quiz">

    <p>

        <b>Question 1.

        <br>A root cause of a nonconformance is defined as a problem that?<br></b>

<blockquote>

<input type="radio" name="q1" value="a"id="q1a"><label for="q1a">is discovered by conducting designed experiments<br>

<input type="radio" name="q1" value="b"id="q1b"><label for="q1b">is established through the use of fishbone diagrams<br>

<input type="radio" name="q1" value="c"id="q1c"><label for="q1c">must be reviewed by the material review board<br>

<input type="radio" name="q1" value="d"id="q1d"><label for="q1d">must be corrected in order to prevent a recurrence<br>

</blockquote>

<p><b>

<hr>

Question 2.

<br>When lower-tier documents are compared to higher-tier documents before the fieldwork starts, the comparison is called a<br></b>

<blockquote>

<input type="radio" name="q2" value="a"id="q2a"><label for="q2a">desk audit<br>

<input type="radio" name="q2" value="b"id="q2b"><label for="q2b">process audit<br>

<input type="radio" name="q2" value="c"id="q2c"><label for="q2c">conformance audit<br>

<input type="radio" name="q2" value="d"id="q2d"><label for="q2d">management audit<br>

</blockquote>

<p><b>

<hr>

Question 3.

<br>An audit trail is necessary in order to<br></b>

<blockquote>

<input type="radio" name="q3" value="a"id="q3a"><label for="q3a">schedule and budget for audit assignments<br>

<input type="radio" name="q3" value="b"id="q3b"><label for="q3b">show how and when items were reviewed<br>

<input type="radio" name="q3" value="c"id="q3c"><label for="q3c">provide management with justification for an audit<br>

<input type="radio" name="q3" value="d"id="q3d"><label for="q3d"> provide the audit manager with audit results<br>

</blockquote>

<p><b>

<hr>

Question 4.

<br>Which of the following audit strategies is a common technique to assess compliance to a specific requirement at all locations where that requirement is applicable?<br></b>

<blockquote>

<input type="radio" name="q4" value="a"id="q4a"><label for="q4a">Discovery method<br>

<input type="radio" name="q4" value="b"id="q4b"><label for="q4b">Element method<br>

<input type="radio" name="q4" value="c"id="q4c"><label for="q4c">Department method<br>

<input type="radio" name="q4" value="d"id="q4d"><label for="q4d">Process method<br>

</blockquote>

<p><b>

<hr>

<input type="button"value="Grade Me"onClick="getScore(this.form);">

<input type="reset" value="Clear"><p>

Number of score out of 15 = <input type= text size 15 name= "mark">

Score in percentage = <input type=text size=15 name="percentage"><br>

</form>

<p>

    <form method="post" name="Form" onsubmit="send" action="mailto:me@mymail.com" input type=text name="percentage">

   <input type=text name="percentage">

<input type="submit" value="Submit results"><br>

</form>

</body>


Here's a clean version of what you've posted. Maybe you can use this as a template to repair the rest of your code...

<!DOCTYPE HTML>

<html lang="en">

<head>

<title>ISO 9001:2015 Internal Auditor Quiz</title>

<meta charset="utf-8">

</head>

<body>

<form method="post" enctype="text/plain" name="form" action="mailto:mail@address.com">

  <p><b>Question 1. <br>

    A root cause of a nonconformance is defined as a problem that?<br>

    </b>

    <input type="radio" name="q1" value="a" id="q1a">

    <label for="q1a"> is discovered by conducting designed experiments</label>

    <br>

    <input type="radio" name="q1" value="b" id="q1b">

    <label for="q1b"> is established through the use of fishbone diagrams</label>

    <br>

    <input type="radio" name="q1" value="c" id="q1c">

    <label for="q1c"> must be reviewed by the material review board</label>

    <br>

    <input type="radio" name="q1" value="d" id="q1d">

    <label for="q1d"> must be corrected in order to prevent a recurrence</label>

  <hr>

  <b>Question 2. <br>

  When lower-tier documents are compared to higher-tier documents before the fieldwork starts, the comparison is called a<br>

  </b>

  <input type="radio" name="q2" value="a" id="q2a">

  <label for="q2a"> desk audit</label>

  <br>

  <input type="radio" name="q2" value="b" id="q2b">

  <label for="q2b"> process audit</label>

  <br>

  <input type="radio" name="q2" value="c" id="q2c">

  <label for="q2c"> conformance audit</label>

  <br>

  <input type="radio" name="q2" value="d" id="q2d">

  <label for="q2d"> management audit</label>

  <br>

  <hr>

  <b> Question 3. <br>

  An audit trail is necessary in order to<br>

  </b>

  <input type="radio" name="q3" value="a" id="q3a">

  <label for="q3a"> schedule and budget for audit assignments</label>

  <br>

  <input type="radio" name="q3" value="b" id="q3b">

  <label for="q3b"> show how and when items were reviewed</label>

  <br>

  <input type="radio" name="q3" value="c" id="q3c">

  <label for="q3c"> provide management with justification for an audit</label>

  <br>

  <input type="radio" name="q3" value="d" id="q3d">

  <label for="q3d"> provide the audit manager with audit results</label>

  <br><hr>

    <b>Question 4. <br>

    Which of the following audit strategies is a common technique to assess compliance to a specific requirement at all locations where that requirement is applicable?<br>

    </b>

  <input type="radio" name="q4" value="a" id="q4a">

  <label for="q4a"> Discovery method</label>

  <br>

  <input type="radio" name="q4" value="b" id="q4b">

  <label for="q4b"> Element method</label>

  <br>

  <input type="radio" name="q4" value="c" id="q4c">

  <label for="q4c"> Department method</label>

  <br>

  <input type="radio" name="q4" value="d" id="q4d">

  <label for="q4d"> Process method</label>

  <hr>

  <p>

    <input type="button" value="Grade Me" onClick="getScore(this.form);">

    <input type="reset" value="Clear">

  </p>

  <p> <b>Number of score out of 15 =</b>

    <input type="text" size="15" name="mark">

  </p>

  <p> <b>Score in percentage =</b>

    <input type="text" size="15" name="percentage">

    <br>

  </p>

  <input type="submit" value="Submit Results">

</form>

</body>

</html>

3 replies

Known Participant
June 1, 2017

I thought so. It was working but at some point during me finishing the Q and A, it stopped working. I've been trying to back track to see if I made any changes that would affect it but I don't see anything.

Wait...was testing in Safari. Just tried it on Fox and Chrome and it works. That may be the difference!

Jon Fritz
Community Expert
Community Expert
June 2, 2017

Safari still doesn't support the html5 required attribute for some reason.

It can be fixed though. Do a quick search for "html5 form validation fallback safari" and you'll be presented with a few different ways to get it working.

Known Participant
June 2, 2017

Okay, will do! Thanks Jon!!

Nancy OShea
Community Expert
Community Expert
May 12, 2017

Do the results absolutely have to be sent by email? 

I put together an interactive quiz that uses Bootstrap & jQuery.  This works for True/False or multiple choice.  At quiz completion, users are provided with feedback -- % answered correctly and the questions missed. You can see a live demo below.

Interactive Exam Multiple Choice

Note this is all done with client-side scripting so it's not super secure.  Anyone with decent coding skills can find the answers if they dig deep enough. 

Nancy

Nancy O'Shea— Product User & Community Expert
Known Participant
May 12, 2017

Nancy,

Is there a way for the results to be posted or sent to the Exam admin? I need to somehow record the results in employee training files. Maybe even a way to print the results once the user is finished?

Jon Fritz
Community Expert
Community Expert
May 12, 2017

You could go ahead and use mailto function in the form action.

Since it's being used internally (I assume it will also be hosted internally and not available online for the general public), there's no worry about spam harvesting of the email address or form security. You would just need to make sure the computer used for testing has an email client installed (like Outlook or Apple Mail).

Get your form questions inside your form tagset and it should work fine.

Nancy OShea
Community Expert
Community Expert
May 11, 2017

For starters, your questions need to be inside the <form> tag.  As it stands now they are in <blockquotes> with no relationship to the <form>.

Mailto: will not work for this.

The results will need to be posted to a database on the internal server and written into an email with a form processing script written in the language supported by your server (PHP, ASP.NET, Perl).   I don't know how skilled you are with forms and processing data with databases & scripts but this is not exactly a beginner's project.  

Nancy

Nancy O'Shea— Product User & Community Expert
Known Participant
May 12, 2017

Thanks Nancy!

No, I'm not very skilled at coding. I just didn't want to pay for any of the quiz builders out there since I figured I could build it in DW. I have everything working pretty well with 15 of 80 questions built, but I just couldn't figure out how to get the results. I will be using this for internal training and I needed a way to get the results and from whom.