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