Submit scores to e-mail using asp

Submit scores to e-mail using asp

am 09.07.2007 17:46:51 von kate.white

Hi
I design and update the internal intranet for an insurance company and
have taught myself HTML and asp. I know enough to design feedback
forms, use java scripts and can just about submit information to a
databse but i dont know how to create a script to calculate a score of
a quiz i have created. I can submit the information via e-mail using
arial buttons to detrmin whether the answer is 'correct' or
'incorrect' but now i am wanting the script to count if the user
answers correct. Any advise?

I have never used a forum before so i hope i'm doing this right.

Thanks
Kate

Re: Submit scores to e-mail using asp

am 09.07.2007 21:45:22 von Jon Paal

not enough information here to help you.

We don't know about your quiz or the formulas for your scoring so....

post some work to date and others may be able to assist on specific questions.



wrote in message news:1183996011.849391.177780@c77g2000hse.googlegroups.com.. .
> Hi
> I design and update the internal intranet for an insurance company and
> have taught myself HTML and asp. I know enough to design feedback
> forms, use java scripts and can just about submit information to a
> databse but i dont know how to create a script to calculate a score of
> a quiz i have created. I can submit the information via e-mail using
> arial buttons to detrmin whether the answer is 'correct' or
> 'incorrect' but now i am wanting the script to count if the user
> answers correct. Any advise?
>
> I have never used a forum before so i hope i'm doing this right.
>
> Thanks
> Kate
>

Re: Submit scores to e-mail using asp

am 10.07.2007 10:08:54 von kate.white

On Jul 9, 8:45 pm, "Jon Paal [MSMD]" com> wrote:
> not enough information here to help you.
>
> We don't know about your quiz or the formulas for your scoring so....
>
> post some work to date and others may be able to assist on specific questions.
>
>
>
> wrote in messagenews:1183996011.849391.177780@c77g2000hse.googlegroup s.com...
> > Hi
> > I design and update the internal intranet for an insurance company and
> > have taught myself HTML and asp. I know enough to design feedback
> > forms, use java scripts and can just about submit information to a
> > databse but i dont know how to create a script to calculate a score of
> > a quiz i have created. I can submit the information via e-mail using
> > arial buttons to detrmin whether the answer is 'correct' or
> > 'incorrect' but now i am wanting the script to count if the user
> > answers correct. Any advise?
>
> > I have never used a forum before so i hope i'm doing this right.
>
> > Thanks
> > Kate- Hide quoted text -
>
> - Show quoted text -

The arial buttons on the html page are set to 'Correct' or 'Incorrect'
if they select the correct answer the string says 'correct'. What i
want to do is add all the correct answers together and total at the
bottom of the mail. Here is my asp script....


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%OPTION EXPLICIT%>
<% Response.Buffer = true %>

<%

Dim fname, man, vq1, vq2, vq3, vq4, vq5, vq6, vq7, vq8, vq9, vq10,
strBody, objMail


fname = Request.Form("name")
man = Request.Form("manager")
vq1 = Request.Form("q1")
vq2 = Request.Form("q2")
vq3 = Request.Form("q3")
vq4 = Request.Form("q4")
vq5 = Request.Form("q5")
vq6 = Request.Form("q6")
vq7 = Request.Form("q7")
vq8 = Request.Form("q8")
vq9 = Request.Form("q9")
vq10 = Request.Form("q10")

strBody = ""
strBody = strBody & " Transitional//EN"">" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & " html; charset=iso-8859-1"" />" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "

cellspacing=""0"" border=""0"">" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & " " & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & " " & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & " tr>" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" &
vbCrlf
strBody = strBody & "
id=""pagetitle"" > Homeserve
>Validation Quiz
 
The
following user submitted their validation quiz on " & now () & "
 
Name: " &
fname & "
Team
Manager: " & man & "
 
Answer
1: " & vq1 & "
Answer
2: " & vq2 & "
Answer
3: " & vq3 & "
Answer
4: " & vq4 & "
Answer
5: " & vq5 & "
Answer
6: " & vq6 & "
Answer
7: " & vq7 & "
Answer
8: " & vq8 & "
Answer
9: " & vq9 & "
Answer
10: " & vq10 & "
 
Total
Score =...... (Out of 10) " & "
 
" & vbCrlf
strBody = strBody & "" & vbCrlf



Set objMail = Server.CreateObject("CDO.Message")
objMail.To = "kate.white@homeserve.com"
'ObjMail.Cc = "kate.white@homeserve.com"
objMail.From = "intranet@home-hotline.com"
objMail.Subject = "Homeserve Validation Quiz"
objMail.HTMLBody = strBody

objMail.Send

Set objMail = Nothing

Response.Redirect ("frame.html")
%>



This is part of my HTML script....













Name td>
 
Team Manager  




























































































 
Q1. href="mailto:Hafeedback.hcm@homeserve.com"
title="mailto:Hafeedback.hcm@homeserve.com" class="style4">When are
Landlord’s Safety checks carried out?



All year round




April to September




October to March

Q2. How much is the cover limit
for Chem Dry emergency repairs?



£300




£500




£1000

Q3. If a Lloyds TSB Easy Home
Warranty Policy cannot be found using the Post Code search what
contact number should you call for customer service?



02476 527839




02476 572128




02476 527812


Q4. If a Customer calls to
request a check be carried out on ‘Water Damaged
Electrics’, what should you advise the customer?



We can’t send ops out until the electrics have been
given time to dry out




Unless there’s an Electrical breakdown we
won’t send an engineer out




Customer will need to claim for flood damaged electrics
from their  Household insurers


Q5. When further work is
identified during a routine service and the boiler is found to be
‘Beyond repair’ Which department deals with it?
    



CAD Gas




Deployment




Customer relations

Q6. Which of the following Post
Codes does NOT come within the M25 Zone?



RH1 - 9




GU1 - 5




MK1 - 4

Q7. span>What must you enter in the Customer’s Reference
field when recording a Chem Dry claim?



Customer’s Reference




We don’t handle Chem Dry claims




Chem Dry reference

Q8. How many new
‘Repudiated’ Category / Subjects are there in Impact? strong>



6




8




10

Q9. When a Fixed Rate Plumbing
Contractor calls from site with a subsequent job, how much can he
expect to be paid for this 2nd Job?



£48




£15




£36

Q10. What is the waiting period
from the initial commencement of a Lloyds TSB Easyhome Warranty
policy before a claim can be made
?



14 days




30 days




28 days



onclick="YY_checkform('form1','q1[0]','#q','2','Please answer question
1','q1[2]','#q','2','Field \'q1[2]\' is not
valid.','q2[0]','#q','2','Please answer question
2','q3[0]','#q','2','Please answer Q3','q4[0]','#q','2','Please answer
question 4','q5[0]','#q','2','Please answer question
5','q6[0]','#q','2','Please answer question
6','q7[0]','#q','2','Please answer question
7','q8[0]','#q','2','Please answer question
8','q9[0]','#q','2','Please answer question
9','q10[0]','#q','2','Please answer question
10','name','#q','0','Please enter your
name','manager','#q','0','Please enter your Team Managers
name');return document.MM_returnValue" value="Submit" />


 






I hope this makes more sense. Can anyone help please?


Thanks
Kate

Re: Submit scores to e-mail using asp

am 10.07.2007 14:34:26 von Jon Paal

Since you have the vq values collected from the form , why don't you determine if it is correct and then simply add them together ?

Re: Submit scores to e-mail using asp

am 10.07.2007 15:21:08 von exjxw.hannivoort

Jon Paal [MSMD] wrote on 10 jul 2007 in
microsoft.public.inetserver.asp.general:

> Since you have the vq values collected from the form , why don't you
> determine if it is correct and then simply add them together ?

Are you replying to something?

[please always quote on usenet]


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: Submit scores to e-mail using asp

am 10.07.2007 16:01:54 von Jon Paal

yes, follow the thread...


"Evertjan." wrote in message news:Xns99699C2BCF77Feejj99@194.109.133.242...
> Jon Paal [MSMD] wrote on 10 jul 2007 in
> microsoft.public.inetserver.asp.general:
>
>> Since you have the vq values collected from the form , why don't you
>> determine if it is correct and then simply add them together ?
>
> Are you replying to something?
>
> [please always quote on usenet]
>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

Re: Submit scores to e-mail using asp

am 10.07.2007 16:18:55 von exjxw.hannivoort

Jon Paal [MSMD] wrote on 10 jul 2007 in
microsoft.public.inetserver.asp.general:

> "Evertjan." wrote
>> Jon Paal [MSMD] wrote on 10 jul 2007 in
>> microsoft.public.inetserver.asp.general:
>>
>>> Since you have the vq values collected from the form , why don't you
>>> determine if it is correct and then simply add them together ?
>>
>> Are you replying to something?
>>
>> [please always quote on usenet]

> yes, follow the thread...

[Please do not toppost on usenet]
Did you affirm that you replied to something,
or that you should always quote?

Could you please tell us which,
and, if the first, what the something was?

[please always quote on usenet]
Not all usenet servers keep or have yet available the previous posting,
so Netiquette rightly demands/advises you should.

[please do not quote signatures on usenet]
Good news readers automagically skip those signatures.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: Submit scores to e-mail using asp

am 10.07.2007 17:58:56 von Jon Paal

if you can't see the thread, then your problem is you need a better newsreader.

Re: Submit scores to e-mail using asp

am 10.07.2007 18:34:55 von exjxw.hannivoort

Jon Paal [MSMD] wrote on 10 jul 2007 in
microsoft.public.inetserver.asp.general:

> if you can't see the thread, then your problem is you need a better
> newsreader.

Jon, it is not about me,
but about you not adhering to perfectly sensible Usenet Netiquette rules.

As I told you, postings are only temporarily available on usenet servers
and arrive not necessarily in the right sequence, so even the best
newsreader cannot read what is not available.

So it is only polite to adhere to the Netiquette.

I is like you are saying that it is perfectly sensible for you to drive on
the wrong side of the road, because you are driving a hummer.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: Submit scores to e-mail using asp

am 11.07.2007 11:47:26 von kate.white

On Jul 10, 5:34 pm, "Evertjan." wrote:
> Jon Paal [MSMD] wrote on 10 jul 2007 in
> microsoft.public.inetserver.asp.general:
>
> > if you can't see the thread, then your problem is you need a better
> > newsreader.
>
> Jon, it is not about me,
> but about you not adhering to perfectly sensible Usenet Netiquette rules.
>
> As I told you, postings are only temporarily available on usenet servers
> and arrive not necessarily in the right sequence, so even the best
> newsreader cannot read what is not available.
>
> So it is only polite to adhere to the Netiquette.
>
> I is like you are saying that it is perfectly sensible for you to drive on
> the wrong side of the road, because you are driving a hummer.
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)







Okay hopefully I am using this forum correctly. I asked someone what
top posting and quote on usenet is....

So Jon paal


I got your message about 'Since you have the vq values collected from
the form , why don't you determine if it is correct and then simply
add them together ?'

This is what i don't know what to do? I have never created a script to
add things together and i don't know where to start. My work is self
taught or copied from out Web desiner at Walsall and i havent been
doing this very long. I do pick things up quite quickly. I just need
to know how to get the script to count each correct answer and then
add together to diplay a score on the e-mail. Can you help?

Many Thnaks
Kate

Re: Submit scores to e-mail using asp

am 11.07.2007 15:05:21 von Jon Paal

fname = Request.Form("name")
man = Request.Form("manager")
vq1 = Request.Form("q1")
vq2 = Request.Form("q2")
vq3 = Request.Form("q3")
vq4 = Request.Form("q4")
vq5 = Request.Form("q5")
vq6 = Request.Form("q6")
vq7 = Request.Form("q7")
vq8 = Request.Form("q8")
vq9 = Request.Form("q9")
vq10 = Request.Form("q10")

' create user total score variable and inititalize= 0
'---------------------------------------------------------
TotalScore = 0

if vq1 = "insert correct answer for vq1 here" then Totalscore = TotalScore + 1

'... repeat for other questions
'--------------------------------------

'insert user's TotalScore into your output
'--------------------------------------------------




> I got your message about 'Since you have the vq values collected from
> the form , why don't you determine if it is correct and then simply
> add them together ?'
>
> This is what i don't know what to do? I have never created a script to
> add things together and i don't know where to start. My work is self
> taught or copied from out Web desiner at Walsall and i havent been
> doing this very long. I do pick things up quite quickly. I just need
> to know how to get the script to count each correct answer and then
> add together to diplay a score on the e-mail. Can you help?
>
> Many Thnaks
> Kate
>

Re: Submit scores to e-mail using asp

am 11.07.2007 17:33:28 von kate.white

On Jul 11, 2:05 pm, "Jon Paal [MSMD]" dot com> wrote:
> fname = Request.Form("name")
> man = Request.Form("manager")
> vq1 = Request.Form("q1")
> vq2 = Request.Form("q2")
> vq3 = Request.Form("q3")
> vq4 = Request.Form("q4")
> vq5 = Request.Form("q5")
> vq6 = Request.Form("q6")
> vq7 = Request.Form("q7")
> vq8 = Request.Form("q8")
> vq9 = Request.Form("q9")
> vq10 = Request.Form("q10")
>
> ' create user total score variable and inititalize= 0
> '---------------------------------------------------------
> TotalScore = 0
>
> if vq1 = "insert correct answer for vq1 here" then Totalscore = TotalScore + 1
>
> '... repeat for other questions
> '--------------------------------------
>
> 'insert user's TotalScore into your output
> '--------------------------------------------------
>
>
>
> > I got your message about 'Since you have the vq values collected from
> > the form , why don't you determine if it is correct and then simply
> > add them together ?'
>
> > This is what i don't know what to do? I have never created a script to
> > add things together and i don't know where to start. My work is self
> > taught or copied from out Web desiner at Walsall and i havent been
> > doing this very long. I do pick things up quite quickly. I just need
> > to know how to get the script to count each correct answer and then
> > add together to diplay a score on the e-mail. Can you help?
>
> > Many Thnaks
> > Kate- Hide quoted text -
>
> - Show quoted text -







Thanks Jon Paal your an absolute star!!!!

Re: Submit scores to e-mail using asp

am 01.09.2007 20:33:13 von JohnWilliams.esquire

On 11 Jul, 16:33, kate.wh...@homeserve.com wrote:
> On Jul 11, 2:05 pm, "Jon Paal [MSMD]" >
>
>
> dot com> wrote:
> > fname = Request.Form("name")
> > man = Request.Form("manager")
> > vq1 = Request.Form("q1")
> > vq2 = Request.Form("q2")
> > vq3 = Request.Form("q3")
> > vq4 = Request.Form("q4")
> > vq5 = Request.Form("q5")
> > vq6 = Request.Form("q6")
> > vq7 = Request.Form("q7")
> > vq8 = Request.Form("q8")
> > vq9 = Request.Form("q9")
> > vq10 = Request.Form("q10")
>
> > ' create user total score variable and inititalize= 0
> > '---------------------------------------------------------
> > TotalScore = 0
>
> > if vq1 = "insert correct answer for vq1 here" then Totalscore = TotalScore + 1
>
> > '... repeat for other questions
> > '--------------------------------------
>
> > 'insert user's TotalScore into your output
> > '--------------------------------------------------
>
> > > I got your message about 'Since you have the vq values collected from
> > > the form , why don't you determine if it is correct and then simply
> > > add them together ?'
>
> > > This is what i don't know what to do? I have never created a script to
> > > add things together and i don't know where to start. My work is self
> > > taught or copied from out Web desiner at Walsall and i havent been
> > > doing this very long. I do pick things up quite quickly. I just need
> > > to know how to get the script to count each correct answer and then
> > > add together to diplay a score on the e-mail. Can you help?
>
> > > Many Thnaks
> > > Kate- Hide quoted text -
>
> > - Show quoted text -
>
> Thanks Jon Paal your an absolute star!!!!

Kate, I've just responded to your post on
microsoft.public.inetsdk.programming.scripting.vbscript and didn't
find your post on this newsgroup. Here's my reply for completeness:

If you're going to post code/HTML it's best to give a complete working
example as much as possible and then
people will spend minimum effort trying to reproduce the problem and
will be more inclined to help. Your code was missing a submit button,
closing and tags and the usual HTML header and body
tags.

Having said all that, I hope the following code does what you want.
The key is to use an array instead of separate variables to store the
answers. Then use a For Next loop to scan the array for correct
answers and keep a running total.

My web host doesn't support CDO.Message and .HTMLBody, so you need to
modify the following code slightly for your system.

---------- quiz.asp ----------

www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



quiz.asp



<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'option explicit

If Request.Form("POSTED") Then

Dim fname, man, strBody, objMail
Dim vqArray(9), i, numCorrect

fname = Request.Form("name")
man = Request.Form("manager")
vqArray(0) = Request.Form("q1")
vqArray(1) = Request.Form("q2")
vqArray(2) = Request.Form("q3")
vqArray(3) = Request.Form("q4")
vqArray(4) = Request.Form("q5")
vqArray(5) = Request.Form("q6")
vqArray(6) = Request.Form("q7")
vqArray(7) = Request.Form("q8")
vqArray(8) = Request.Form("q9")
vqArray(9) = Request.Form("q10")

numCorrect = 0
For i = 0 To 9
If Instr(vqArray(i),"-Correct") Then numCorrect = numCorrect + 1
Next

strBody = ""
strBody = strBody & " Transitional//EN"">" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & " html; charset=iso-8859-1"" />" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "

cellspacing=""0"" border=""0"">" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & " " & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & " " & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf
strBody = strBody & "" & vbCrlf & vbCrlf & vbCrlf &
vbCrlf
strBody = strBody & "" & vbCrlf
strBody = strBody & "" &
vbCrlf & vbCrlf
strBody = strBody & "" &
vbCrlf
strBody = strBody & "
id=""pagetitle"" > Homeserve
Validation
Quiz
 
The
following user submitted their validation quiz on " & now () &
"
 
Name: " &
fname & "
Team
Manager: " & man & "
 
Answer 1:
" & vqArray(0) & "
Answer 2:
" & vqArray(1) & "
Answer 3:
" & vqArray(2) & "
Answer 4:
" & vqArray(3) & "
Answer 5:
" & vqArray(4) & "
Answer 6:
" & vqArray(5) & "
Answer 7:
" & vqArray(6) & "
Answer 8:
" & vqArray(7) & "
Answer 9:
" & vqArray(8) & "
Answer
10: " & vqArray(9) & "
 
Total
Score = " & numCorrect & " (Out of 10) " & "
 
" & vbCrlf
strBody = strBody & "" & vbCrlf

'Set objMail = Server.CreateObject("CDO.Message")
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.To = "email@yourdomain.com"
'ObjMail.Cc = "kate.wh...@homeserve.com"
objMail.From = "email@yourdomain.com"
objMail.Subject = "Homeserve Validation Quiz"
objMail.BodyFormat = 0 '(0=MIME 1=Text)
'objMail.HTMLBody = strBody
objMail.Body = strBody

objMail.Send

Set objMail = Nothing

Response.Redirect "quiz-submitted.html"

Else
%>















Name  
Team Manager  












































 
Q1. When are Landlord’s Safety checks
carried out?


All year round p>



April to September




October to March

Q2. How much is the cover limit for Chem
Dry emergency repairs?


£300 p>


£500



£1000 p>

Q3. If a Lloyds TSB Easy Home
Warranty Policy cannot be found using the Post Code search what
contact number should you call for customer service?


02476 527839 p>


02476 572128 p>


02476 527812


Q4. If a Customer calls to
request a check be carried out on ‘Water Damaged
Electrics’, what should you advise the customer?



We can’t send ops out until the electrics have been
given time to dry out




Unless there’s an Electrical breakdown we
won’t send an engineer out




Customer will need to claim for flood damaged
electrics from their  Household insurers


>



<%
End If
%>