Chilisoft ASP script for my church - I need help

Reply

Join Date: Feb 2008
Posts: 2
Reputation: artisticre is an unknown quantity at this point 
Solved Threads: 0
artisticre artisticre is offline Offline
Newbie Poster

Chilisoft ASP script for my church - I need help

 
0
  #1
Feb 5th, 2008
I have a script I got from someone that is running on microsoft ASP. It works for him but the send mail function did not work because I have Chilisoft ASP. I managed to get the send mail part working but the results are not printing on the webpage and not in the emails. I am doing this as a favor for my church and I really need help. Can someone please suggest something? I am not an ASP person but am trying to understand it.


  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Spiritual Gifts Assessment</title>
  6. <style type="text/css">
  7. *
  8. {
  9. font-family: Verdana, Arial, Helvetica, sans-serif;
  10. font-size: 12px;
  11. }
  12. body { background: #E5E0C4; }
  13. .red { color: red; }
  14. h4
  15. {
  16. color: #547375;
  17. }
  18. </style>
  19. </head>
  20. <body>
  21. <button onclick="javascript: window.print()" value="Print Results">Print Results</button>
  22. <!-- #include file = "arrQuestions.asp" -->
  23. <%
  24. Function isValidEmail(myEmail)
  25. 'Email validation
  26. dim isValidE
  27. dim regEx
  28.  
  29. isValidE = True
  30. set regEx = New RegExp
  31.  
  32. regEx.IgnoreCase = False
  33.  
  34. regEx.Pattern = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
  35. isValidE = regEx.Test(myEmail)
  36.  
  37. isValidEmail = isValidE
  38. End Function
  39.  
  40. email = trim(Request.Form("email"))
  41. emailValid = isValidEmail(email)
  42.  
  43. 'define arrays for getting data and for each spirtiual gift
  44. dim arrQdata(143)
  45. dim arrAdministration(7)
  46. dim arrApostleship(7)
  47. dim arrCompassion(7)
  48. dim arrDiscernment(7)
  49. dim arrEncouragement(7)
  50. dim arrEvangelism(7)
  51. dim arrFaith(7)
  52. dim arrGiving(7)
  53. dim arrHealing(7)
  54. dim arrKnowledge(7)
  55. dim arrLeadership(7)
  56. dim arrPastoring(7)
  57. dim arrProphecy(7)
  58. dim arrServing(7)
  59. dim arrTeaching(7)
  60. dim arrTongues(7)
  61. dim arrWisdom(7)
  62. dim arrWorkingMiracles(7)
  63.  
  64. 'grab the answers from form into array "arrQdata()"
  65. for j = 0 to 143
  66. arrQdata(j) = Request.Form("question" & j)
  67. 'Response.Write(arrQdata(i))
  68. next
  69.  
  70. x = 0
  71. for c = 1 to 144 step 18
  72. arrAdministration(x) = arrQdata(c - 1)
  73. x = x + 1
  74. next
  75.  
  76. x = 0
  77. for c = 2 to 144 step 18
  78. arrApostleship(x) = arrQdata(c - 1)
  79. x = x + 1
  80. next
  81.  
  82. x = 0
  83. for c = 3 to 144 step 18
  84. arrCompassion(x) = arrQdata(c - 1)
  85. x = x + 1
  86. next
  87.  
  88. x = 0
  89. for c = 4 to 144 step 18
  90. arrDiscernment(x) = arrQdata(c - 1)
  91. x = x + 1
  92. next
  93.  
  94. x = 0
  95. for c = 5 to 144 step 18
  96. arrEncouragement(x) = arrQdata(c - 1)
  97. x = x + 1
  98. next
  99.  
  100. x = 0
  101. for c = 6 to 144 step 18
  102. arrEvangelism(x) = arrQdata(c - 1)
  103. x = x + 1
  104. next
  105.  
  106. x = 0
  107. for c = 7 to 144 step 18
  108. arrFaith(x) = arrQdata(c - 1)
  109. x = x + 1
  110. next
  111.  
  112. x = 0
  113. for c = 8 to 144 step 18
  114. arrGiving(x) = arrQdata(c - 1)
  115. x = x + 1
  116. next
  117.  
  118. x = 0
  119. for c = 9 to 144 step 18
  120. arrHealing(x) = arrQdata(c - 1)
  121. x = x + 1
  122. next
  123.  
  124. x = 0
  125. for c = 10 to 144 step 18
  126. arrKnowledge(x) = arrQdata(c - 1)
  127. x = x + 1
  128. next
  129.  
  130. x = 0
  131. for c = 11 to 144 step 18
  132. arrLeadership(x) = arrQdata(c - 1)
  133. x = x + 1
  134. next
  135.  
  136. x = 0
  137. for c = 12 to 144 step 18
  138. arrPastoring(x) = arrQdata(c - 1)
  139. x = x + 1
  140. next
  141.  
  142. x = 0
  143. for c = 13 to 144 step 18
  144. arrProphecy(x) = arrQdata(c - 1)
  145. x = x + 1
  146. next
  147.  
  148. x = 0
  149. for c = 14 to 144 step 18
  150. arrServing(x) = arrQdata(c - 1)
  151. x = x + 1
  152. next
  153.  
  154. x = 0
  155. for c = 15 to 144 step 18
  156. arrTeaching(x) = arrQdata(c - 1)
  157. x = x + 1
  158. next
  159.  
  160. x = 0
  161. for c = 16 to 144 step 18
  162. arrTongues(x) = arrQdata(c - 1)
  163. x = x + 1
  164. next
  165.  
  166. x = 0
  167. for c = 17 to 144 step 18
  168. arrWisdom(x) = arrQdata(c - 1)
  169. x = x + 1
  170. next
  171.  
  172. x = 0
  173. for c = 18 to 144 step 18
  174. arrWorkingMiracles(x) = arrQdata(c - 1)
  175. x = x + 1
  176. next
  177.  
  178. scoreAdministration = 0
  179. scoreApostleship = 0
  180. scoreCompassion = 0
  181. scoreDiscernment = 0
  182. scoreEncouragement = 0
  183. scoreEvangelism = 0
  184. scoreFaith = 0
  185. scoreGiving = 0
  186. scoreHealing = 0
  187. scoreKnowledge = 0
  188. scoreLeadership = 0
  189. scorePastoring = 0
  190. scoreProphecy = 0
  191. scoreServing = 0
  192. scoreTeaching = 0
  193. scoreTongues = 0
  194. scoreWisdom = 0
  195. scoreWorkingMiracles = 0
  196.  
  197. 'add up the total scores for each category
  198. for i = 0 to 7
  199. scoreAdministration = scoreAdministration + arrAdministration(i)
  200. scoreApostleship = scoreApostleship + arrApostleship(i)
  201. scoreCompassion = scoreCompassion + arrCompassion(i)
  202. scoreDiscernment = scoreDiscernment + arrDiscernment(i)
  203. scoreEncouragement = scoreEncouragement + arrEncouragement(i)
  204. scoreEvangelism = scoreEvangelism + arrEvangelism(i)
  205. scoreFaith = scoreFaith + arrFaith(i)
  206. scoreGiving = scoreGiving + arrGiving(i)
  207. scoreHealing = scoreHealing + arrHealing(i)
  208. scoreKnowledge = scoreKnowledge + arrKnowledge(i)
  209. scoreLeadership = scoreLeadership + arrLeadership(i)
  210. scorePastoring = scorePastoring + arrPastoring(i)
  211. scoreProphecy = scoreProphecy + arrProphecy(i)
  212. scoreServing = scoreServing + arrServing(i)
  213. scoreTeaching = scoreTeaching + arrTeaching(i)
  214. scoreTongues = scoreTongues + arrTongues(i)
  215. scoreWisdom = scoreWisdom + arrWisdom(i)
  216. scoreWorkingMiracles = scoreWorkingMiracles + arrWorkingMiracles(i)
  217. next
  218.  
  219. dim arr2d_finalResults(17, 1)
  220. arr2d_finalResults(0, 0) = "Administration"
  221. arr2d_finalResults(0, 1) = scoreAdministration
  222. arr2d_finalResults(1, 0) = "Apostleship"
  223. arr2d_finalResults(1, 1) = scoreApostleship
  224. arr2d_finalResults(2, 0) = "Compassion / Mercy"
  225. arr2d_finalResults(2, 1) = scoreCompassion
  226. arr2d_finalResults(3, 0) = "Discernment"
  227. arr2d_finalResults(3, 1) = scoreDiscernment
  228. arr2d_finalResults(4, 0) = "Encouragement"
  229. arr2d_finalResults(4, 1) = scoreEncouragement
  230. arr2d_finalResults(5, 0) = "Evangelism"
  231. arr2d_finalResults(5, 1) = scoreEvangelism
  232. arr2d_finalResults(6, 0) = "Faith"
  233. arr2d_finalResults(6, 1) = scoreFaith
  234. arr2d_finalResults(7, 0) = "Giving"
  235. arr2d_finalResults(7, 1) = scoreGiving
  236. arr2d_finalResults(8, 0) = "Healing"
  237. arr2d_finalResults(8, 1) = scoreHealing
  238. arr2d_finalResults(9, 0) = "Knowledge"
  239. arr2d_finalResults(9, 1) = scoreKnowledge
  240. arr2d_finalResults(10, 0) = "Leadership"
  241. arr2d_finalResults(10, 1) = scoreLeadership
  242. arr2d_finalResults(11, 0) = "Pastoring"
  243. arr2d_finalResults(11, 1) = scorePastoring
  244. arr2d_finalResults(12, 0) = "Prophecy"
  245. arr2d_finalResults(12, 1) = scoreProphecy
  246. arr2d_finalResults(13, 0) = "Serving"
  247. arr2d_finalResults(13, 1) = scoreServing
  248. arr2d_finalResults(14, 0) = "Teaching"
  249. arr2d_finalResults(14, 1) = scoreTeaching
  250. arr2d_finalResults(15, 0) = "Tongues / Interpretation"
  251. arr2d_finalResults(15, 1) = scoreTongues
  252. arr2d_finalResults(16, 0) = "Wisdom"
  253. arr2d_finalResults(16, 1) = scoreWisdom
  254. arr2d_finalResults(17, 0) = "Working Miracles"
  255. arr2d_finalResults(17, 1) = scoreWorkingMiracles
  256.  
  257. Sub DualSorter( byRef arrArray, DimensionToSort )
  258. Dim row, j, StartingKeyValue, StartingOtherValue, _
  259. NewStartingKey, NewStartingOther, _
  260. swap_pos, OtherDimension
  261. Const column = 1
  262.  
  263. ' Ensure that the user has picked a valid DimensionToSort
  264. If DimensionToSort = 1 then
  265. OtherDimension = 0
  266. ElseIf DimensionToSort = 0 then
  267. OtherDimension = 1
  268. Else
  269. 'Shoot, invalid value of DimensionToSort
  270. Response.Write "Invalid dimension for DimensionToSort: " & _
  271. "must be value of 1 or 0."
  272. Response.End
  273. End If
  274.  
  275. For row = 0 To UBound( arrArray, column ) - 1
  276. 'Start outer loop.
  277.  
  278. 'Take a snapshot of the first element
  279. 'in the array because if there is a
  280. 'smaller value elsewhere in the array
  281. 'we'll need to do a swap.
  282. StartingKeyValue = arrArray ( row, DimensionToSort )
  283. StartingOtherValue = arrArray ( row, OtherDimension )
  284.  
  285. ' Default the Starting values to the First Record
  286. NewStartingKey = arrArray ( row, DimensionToSort )
  287. NewStartingOther = arrArray ( row, OtherDimension )
  288.  
  289. swap_pos = row
  290.  
  291. For j = row + 1 to UBound( arrArray, column )
  292. 'Start inner loop.
  293. If arrArray ( j, DimensionToSort ) < NewStartingKey Then
  294. 'This is now the lowest number -
  295. 'remember it's position.
  296. swap_pos = j
  297. NewStartingKey = arrArray ( j, DimensionToSort )
  298. NewStartingOther = arrArray ( j, OtherDimension )
  299. End If
  300. Next
  301.  
  302. If swap_pos <> row Then
  303. 'If we get here then we are about to do a swap
  304. 'within the array.
  305. arrArray ( swap_pos, DimensionToSort ) = StartingKeyValue
  306. arrArray ( swap_pos, OtherDimension ) = StartingOtherValue
  307.  
  308. arrArray ( row, DimensionToSort ) = NewStartingKey
  309. arrArray ( row, OtherDimension ) = NewStartingOther
  310. End If
  311. Next
  312. End Sub
  313.  
  314.  
  315.  
  316. call DualSorter(arr2d_finalResults, 1)
  317.  
  318. For i = UBound(arr2d_finalResults) to LBound(arr2d_finalResults) step -1
  319. theresults = theresults & arr2d_finalResults(i, 0) & " = " & arr2d_finalResults(i, 1) & vbCrLf
  320. Next
  321. 'sending the email
  322. if emailValid = true then
  323.  
  324. Dim mailmsg
  325. Set mailmsg = Server.CreateObject("CDONTS.NewMail")
  326. mailmsg.From = "xxx"
  327. mailmsg.To = "xxx"
  328. mailmsg.Subject = email_message & "Assessment Results" & vbCrLf
  329. mailmsg.Body = email_message & theresults
  330. mailmsg.Send
  331. Set mailmsg = Nothing
  332. Response.Write "Thank you for participating in the spiritual gifts assessment.<br/>The results you see below have also been sent to your email address."
  333. else
  334. Response.Write "We're sorry, but the email you have entered does not appear to be valid. Your results are below, however they could not be emailed to your address."
  335.  
  336. end if
  337.  
  338.  
  339. %>
  340. <h4><%=something%></h4>
  341. <table cellpadding="3">
  342. <tr>
  343. <th align="left">Spiritual Gift</th>
  344. <th align="left">Score</th>
  345. </tr>
  346. <% for i = UBound(arr2d_finalResults) to LBound(arr2d_finalResults) step -1 %>
  347. <tr>
  348. <td><%=arr2d_finalResults(i, 0)%></td>
  349. <td align="center"><%=arr2d_finalResults(i, 1)%></td>
  350. </tr>
  351. <% next %>
  352. </table>
  353. </body>
  354. </html>
Last edited by peter_budo; Feb 6th, 2008 at 2:00 pm. Reason: Closing tag is [/code] insted of [\code] ;)
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 2
Reputation: artisticre is an unknown quantity at this point 
Solved Threads: 0
artisticre artisticre is offline Offline
Newbie Poster

Re: Chilisoft ASP script for my church - I need help

 
0
  #2
Feb 7th, 2008
I see there was a problem posting my code so I am posting it again. I really need some help with this because I am stumped. The send mail works but it does not print the results on the page or in the email.



  1.  
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  7. <title>Spiritual Gifts Assessment</title>
  8. <style type="text/css">
  9. *
  10. {
  11. font-family: Verdana, Arial, Helvetica, sans-serif;
  12. font-size: 12px;
  13. }
  14. body { background: #E5E0C4; }
  15. .red { color: red; }
  16. h4
  17. {
  18. color: #547375;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <button onclick="javascript: window.print()" value="Print Results">Print Results</button>
  24. <!-- #include file = "arrQuestions.asp" -->
  25. <%
  26. Function isValidEmail(myEmail)
  27. 'Email validation
  28. dim isValidE
  29. dim regEx
  30.  
  31. isValidE = True
  32. set regEx = New RegExp
  33.  
  34. regEx.IgnoreCase = False
  35.  
  36. regEx.Pattern = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
  37. isValidE = regEx.Test(myEmail)
  38.  
  39. isValidEmail = isValidE
  40. End Function
  41.  
  42. email = trim(Request.Form("email"))
  43. emailValid = isValidEmail(email)
  44.  
  45. 'define arrays for getting data and for each spirtiual gift
  46. dim arrQdata(143)
  47. dim arrAdministration(7)
  48. dim arrApostleship(7)
  49. dim arrCompassion(7)
  50. dim arrDiscernment(7)
  51. dim arrEncouragement(7)
  52. dim arrEvangelism(7)
  53. dim arrFaith(7)
  54. dim arrGiving(7)
  55. dim arrHealing(7)
  56. dim arrKnowledge(7)
  57. dim arrLeadership(7)
  58. dim arrPastoring(7)
  59. dim arrProphecy(7)
  60. dim arrServing(7)
  61. dim arrTeaching(7)
  62. dim arrTongues(7)
  63. dim arrWisdom(7)
  64. dim arrWorkingMiracles(7)
  65.  
  66. 'grab the answers from form into array "arrQdata()"
  67. for j = 0 to 143
  68. arrQdata(j) = Request.Form("question" & j)
  69. 'Response.Write(arrQdata(i))
  70. next
  71.  
  72. x = 0
  73. for c = 1 to 144 step 18
  74. arrAdministration(x) = arrQdata(c - 1)
  75. x = x + 1
  76. next
  77.  
  78. x = 0
  79. for c = 2 to 144 step 18
  80. arrApostleship(x) = arrQdata(c - 1)
  81. x = x + 1
  82. next
  83.  
  84. x = 0
  85. for c = 3 to 144 step 18
  86. arrCompassion(x) = arrQdata(c - 1)
  87. x = x + 1
  88. next
  89.  
  90. x = 0
  91. for c = 4 to 144 step 18
  92. arrDiscernment(x) = arrQdata(c - 1)
  93. x = x + 1
  94. next
  95.  
  96. x = 0
  97. for c = 5 to 144 step 18
  98. arrEncouragement(x) = arrQdata(c - 1)
  99. x = x + 1
  100. next
  101.  
  102. x = 0
  103. for c = 6 to 144 step 18
  104. arrEvangelism(x) = arrQdata(c - 1)
  105. x = x + 1
  106. next
  107.  
  108. x = 0
  109. for c = 7 to 144 step 18
  110. arrFaith(x) = arrQdata(c - 1)
  111. x = x + 1
  112. next
  113.  
  114. x = 0
  115. for c = 8 to 144 step 18
  116. arrGiving(x) = arrQdata(c - 1)
  117. x = x + 1
  118. next
  119.  
  120. x = 0
  121. for c = 9 to 144 step 18
  122. arrHealing(x) = arrQdata(c - 1)
  123. x = x + 1
  124. next
  125.  
  126. x = 0
  127. for c = 10 to 144 step 18
  128. arrKnowledge(x) = arrQdata(c - 1)
  129. x = x + 1
  130. next
  131.  
  132. x = 0
  133. for c = 11 to 144 step 18
  134. arrLeadership(x) = arrQdata(c - 1)
  135. x = x + 1
  136. next
  137.  
  138. x = 0
  139. for c = 12 to 144 step 18
  140. arrPastoring(x) = arrQdata(c - 1)
  141. x = x + 1
  142. next
  143.  
  144. x = 0
  145. for c = 13 to 144 step 18
  146. arrProphecy(x) = arrQdata(c - 1)
  147. x = x + 1
  148. next
  149.  
  150. x = 0
  151. for c = 14 to 144 step 18
  152. arrServing(x) = arrQdata(c - 1)
  153. x = x + 1
  154. next
  155.  
  156. x = 0
  157. for c = 15 to 144 step 18
  158. arrTeaching(x) = arrQdata(c - 1)
  159. x = x + 1
  160. next
  161.  
  162. x = 0
  163. for c = 16 to 144 step 18
  164. arrTongues(x) = arrQdata(c - 1)
  165. x = x + 1
  166. next
  167.  
  168. x = 0
  169. for c = 17 to 144 step 18
  170. arrWisdom(x) = arrQdata(c - 1)
  171. x = x + 1
  172. next
  173.  
  174. x = 0
  175. for c = 18 to 144 step 18
  176. arrWorkingMiracles(x) = arrQdata(c - 1)
  177. x = x + 1
  178. next
  179.  
  180. scoreAdministration = 0
  181. scoreApostleship = 0
  182. scoreCompassion = 0
  183. scoreDiscernment = 0
  184. scoreEncouragement = 0
  185. scoreEvangelism = 0
  186. scoreFaith = 0
  187. scoreGiving = 0
  188. scoreHealing = 0
  189. scoreKnowledge = 0
  190. scoreLeadership = 0
  191. scorePastoring = 0
  192. scoreProphecy = 0
  193. scoreServing = 0
  194. scoreTeaching = 0
  195. scoreTongues = 0
  196. scoreWisdom = 0
  197. scoreWorkingMiracles = 0
  198.  
  199. 'add up the total scores for each category
  200. for i = 0 to 7
  201. scoreAdministration = scoreAdministration + arrAdministration(i)
  202. scoreApostleship = scoreApostleship + arrApostleship(i)
  203. scoreCompassion = scoreCompassion + arrCompassion(i)
  204. scoreDiscernment = scoreDiscernment + arrDiscernment(i)
  205. scoreEncouragement = scoreEncouragement + arrEncouragement(i)
  206. scoreEvangelism = scoreEvangelism + arrEvangelism(i)
  207. scoreFaith = scoreFaith + arrFaith(i)
  208. scoreGiving = scoreGiving + arrGiving(i)
  209. scoreHealing = scoreHealing + arrHealing(i)
  210. scoreKnowledge = scoreKnowledge + arrKnowledge(i)
  211. scoreLeadership = scoreLeadership + arrLeadership(i)
  212. scorePastoring = scorePastoring + arrPastoring(i)
  213. scoreProphecy = scoreProphecy + arrProphecy(i)
  214. scoreServing = scoreServing + arrServing(i)
  215. scoreTeaching = scoreTeaching + arrTeaching(i)
  216. scoreTongues = scoreTongues + arrTongues(i)
  217. scoreWisdom = scoreWisdom + arrWisdom(i)
  218. scoreWorkingMiracles = scoreWorkingMiracles + arrWorkingMiracles(i)
  219. next
  220.  
  221. dim arr2d_finalResults(17, 1)
  222. arr2d_finalResults(0, 0) = "Administration"
  223. arr2d_finalResults(0, 1) = scoreAdministration
  224. arr2d_finalResults(1, 0) = "Apostleship"
  225. arr2d_finalResults(1, 1) = scoreApostleship
  226. arr2d_finalResults(2, 0) = "Compassion / Mercy"
  227. arr2d_finalResults(2, 1) = scoreCompassion
  228. arr2d_finalResults(3, 0) = "Discernment"
  229. arr2d_finalResults(3, 1) = scoreDiscernment
  230. arr2d_finalResults(4, 0) = "Encouragement"
  231. arr2d_finalResults(4, 1) = scoreEncouragement
  232. arr2d_finalResults(5, 0) = "Evangelism"
  233. arr2d_finalResults(5, 1) = scoreEvangelism
  234. arr2d_finalResults(6, 0) = "Faith"
  235. arr2d_finalResults(6, 1) = scoreFaith
  236. arr2d_finalResults(7, 0) = "Giving"
  237. arr2d_finalResults(7, 1) = scoreGiving
  238. arr2d_finalResults(8, 0) = "Healing"
  239. arr2d_finalResults(8, 1) = scoreHealing
  240. arr2d_finalResults(9, 0) = "Knowledge"
  241. arr2d_finalResults(9, 1) = scoreKnowledge
  242. arr2d_finalResults(10, 0) = "Leadership"
  243. arr2d_finalResults(10, 1) = scoreLeadership
  244. arr2d_finalResults(11, 0) = "Pastoring"
  245. arr2d_finalResults(11, 1) = scorePastoring
  246. arr2d_finalResults(12, 0) = "Prophecy"
  247. arr2d_finalResults(12, 1) = scoreProphecy
  248. arr2d_finalResults(13, 0) = "Serving"
  249. arr2d_finalResults(13, 1) = scoreServing
  250. arr2d_finalResults(14, 0) = "Teaching"
  251. arr2d_finalResults(14, 1) = scoreTeaching
  252. arr2d_finalResults(15, 0) = "Tongues / Interpretation"
  253. arr2d_finalResults(15, 1) = scoreTongues
  254. arr2d_finalResults(16, 0) = "Wisdom"
  255. arr2d_finalResults(16, 1) = scoreWisdom
  256. arr2d_finalResults(17, 0) = "Working Miracles"
  257. arr2d_finalResults(17, 1) = scoreWorkingMiracles
  258.  
  259. Sub DualSorter( byRef arrArray, DimensionToSort )
  260. Dim row, j, StartingKeyValue, StartingOtherValue, _
  261. NewStartingKey, NewStartingOther, _
  262. swap_pos, OtherDimension
  263. Const column = 1
  264.  
  265. ' Ensure that the user has picked a valid DimensionToSort
  266. If DimensionToSort = 1 then
  267. OtherDimension = 0
  268. ElseIf DimensionToSort = 0 then
  269. OtherDimension = 1
  270. Else
  271. 'Shoot, invalid value of DimensionToSort
  272. Response.Write "Invalid dimension for DimensionToSort: " & _
  273. "must be value of 1 or 0."
  274. Response.End
  275. End If
  276.  
  277. For row = 0 To UBound( arrArray, column ) - 1
  278. 'Start outer loop.
  279.  
  280. 'Take a snapshot of the first element
  281. 'in the array because if there is a
  282. 'smaller value elsewhere in the array
  283. 'we'll need to do a swap.
  284. StartingKeyValue = arrArray ( row, DimensionToSort )
  285. StartingOtherValue = arrArray ( row, OtherDimension )
  286.  
  287. ' Default the Starting values to the First Record
  288. NewStartingKey = arrArray ( row, DimensionToSort )
  289. NewStartingOther = arrArray ( row, OtherDimension )
  290.  
  291. swap_pos = row
  292.  
  293. For j = row + 1 to UBound( arrArray, column )
  294. 'Start inner loop.
  295. If arrArray ( j, DimensionToSort ) < NewStartingKey Then
  296. 'This is now the lowest number -
  297. 'remember it's position.
  298. swap_pos = j
  299. NewStartingKey = arrArray ( j, DimensionToSort )
  300. NewStartingOther = arrArray ( j, OtherDimension )
  301. End If
  302. Next
  303.  
  304. If swap_pos <> row Then
  305. 'If we get here then we are about to do a swap
  306. 'within the array.
  307. arrArray ( swap_pos, DimensionToSort ) = StartingKeyValue
  308. arrArray ( swap_pos, OtherDimension ) = StartingOtherValue
  309.  
  310. arrArray ( row, DimensionToSort ) = NewStartingKey
  311. arrArray ( row, OtherDimension ) = NewStartingOther
  312. End If
  313. Next
  314. End Sub
  315.  
  316.  
  317.  
  318. call DualSorter(arr2d_finalResults, 1)
  319.  
  320. For i = UBound(arr2d_finalResults) to LBound(arr2d_finalResults) step -1
  321. theresults = theresults & arr2d_finalResults(i, 0) & " = " & arr2d_finalResults(i, 1) & vbCrLf
  322. Next
  323. 'sending the email
  324. if emailValid = true then
  325.  
  326. Dim mailmsg
  327. Set mailmsg = Server.CreateObject("CDONTS.NewMail")
  328. mailmsg.From = "xxx"
  329. mailmsg.To = "xxx"
  330. mailmsg.Subject = email_message & "Assessment Results" & vbCrLf
  331. mailmsg.Body = email_message & theresults
  332. mailmsg.Send
  333. Set mailmsg = Nothing
  334. Response.Write "Thank you for participating in the spiritual gifts assessment.<br/>The results you see below have also been sent to your email address."
  335. else
  336. Response.Write "We're sorry, but the email you have entered does not appear to be valid. Your results are below, however they could not be emailed to your address."
  337.  
  338. end if
  339.  
  340.  
  341. %>
  342. <h4><%=something%></h4>
  343. <table cellpadding="3">
  344. <tr>
  345. <th align="left">Spiritual Gift</th>
  346. <th align="left">Score</th>
  347. </tr>
  348. <% for i = UBound(arr2d_finalResults) to LBound(arr2d_finalResults) step -1 %>
  349. <tr>
  350. <td><%=arr2d_finalResults(i, 0)%></td>
  351. <td align="center"><%=arr2d_finalResults(i, 1)%></td>
  352. </tr>
  353. <% next %>
  354. </table>
  355. </body>
  356. </html>
  357.  
  358. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Spiritual Gifts Assessment</title> <style type="text/css"> * { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } body { background: #E5E0C4; } .red { color: red; } h4 { color: #547375; } </style> </head> <body> <button onclick="javascript<b></b>: window.print()" value="Print Results">Print Results</button> <!-- #include file = "arrQuestions.asp" --> <% Function isValidEmail(myEmail) 'Email validation dim isValidE dim regEx isValidE = True set regEx = New RegExp regEx.IgnoreCase = False regEx.Pattern = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$" isValidE = regEx.Test(myEmail) isValidEmail = isValidE End Function email = trim(Request.Form("email")) emailValid = isValidEmail(email) 'define arrays for getting data and for each spirtiual gift dim arrQdata(143) dim arrAdministration(7) dim arrApostleship(7) dim arrCompassion(7) dim arrDiscernment(7) dim arrEncouragement(7) dim arrEvangelism(7) dim arrFaith(7) dim arrGiving(7) dim arrHealing(7) dim arrKnowledge(7) dim arrLeadership(7) dim arrPastoring(7) dim arrProphecy(7) dim arrServing(7) dim arrTeaching(7) dim arrTongues(7) dim arrWisdom(7) dim arrWorkingMiracles(7) 'grab the answers from form into array "arrQdata()" for j = 0 to 143 arrQdata(j) = Request.Form("question" & j) 'Response.Write(arrQdata(i)) next x = 0 for c = 1 to 144 step 18 arrAdministration(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 2 to 144 step 18 arrApostleship(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 3 to 144 step 18 arrCompassion(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 4 to 144 step 18 arrDiscernment(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 5 to 144 step 18 arrEncouragement(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 6 to 144 step 18 arrEvangelism(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 7 to 144 step 18 arrFaith(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 8 to 144 step 18 arrGiving(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 9 to 144 step 18 arrHealing(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 10 to 144 step 18 arrKnowledge(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 11 to 144 step 18 arrLeadership(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 12 to 144 step 18 arrPastoring(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 13 to 144 step 18 arrProphecy(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 14 to 144 step 18 arrServing(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 15 to 144 step 18 arrTeaching(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 16 to 144 step 18 arrTongues(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 17 to 144 step 18 arrWisdom(x) = arrQdata(c - 1) x = x + 1 next x = 0 for c = 18 to 144 step 18 arrWorkingMiracles(x) = arrQdata(c - 1) x = x + 1 next scoreAdministration = 0 scoreApostleship = 0 scoreCompassion = 0 scoreDiscernment = 0 scoreEncouragement = 0 scoreEvangelism = 0 scoreFaith = 0 scoreGiving = 0 scoreHealing = 0 scoreKnowledge = 0 scoreLeadership = 0 scorePastoring = 0 scoreProphecy = 0 scoreServing = 0 scoreTeaching = 0 scoreTongues = 0 scoreWisdom = 0 scoreWorkingMiracles = 0 'add up the total scores for each category for i = 0 to 7 scoreAdministration = scoreAdministration + arrAdministration(i) scoreApostleship = scoreApostleship + arrApostleship(i) scoreCompassion = scoreCompassion + arrCompassion(i) scoreDiscernment = scoreDiscernment + arrDiscernment(i) scoreEncouragement = scoreEncouragement + arrEncouragement(i) scoreEvangelism = scoreEvangelism + arrEvangelism(i) scoreFaith = scoreFaith + arrFaith(i) scoreGiving = scoreGiving + arrGiving(i) scoreHealing = scoreHealing + arrHealing(i) scoreKnowledge = scoreKnowledge + arrKnowledge(i) scoreLeadership = scoreLeadership + arrLeadership(i) scorePastoring = scorePastoring + arrPastoring(i) scoreProphecy = scoreProphecy + arrProphecy(i) scoreServing = scoreServing + arrServing(i) scoreTeaching = scoreTeaching + arrTeaching(i) scoreTongues = scoreTongues + arrTongues(i) scoreWisdom = scoreWisdom + arrWisdom(i) scoreWorkingMiracles = scoreWorkingMiracles + arrWorkingMiracles(i) next dim arr2d_finalResults(17, 1) arr2d_finalResults(0, 0) = "Administration" arr2d_finalResults(0, 1) = scoreAdministration arr2d_finalResults(1, 0) = "Apostleship" arr2d_finalResults(1, 1) = scoreApostleship arr2d_finalResults(2, 0) = "Compassion / Mercy" arr2d_finalResults(2, 1) = scoreCompassion arr2d_finalResults(3, 0) = "Discernment" arr2d_finalResults(3, 1) = scoreDiscernment arr2d_finalResults(4, 0) = "Encouragement" arr2d_finalResults(4, 1) = scoreEncouragement arr2d_finalResults(5, 0) = "Evangelism" arr2d_finalResults(5, 1) = scoreEvangelism arr2d_finalResults(6, 0) = "Faith" arr2d_finalResults(6, 1) = scoreFaith arr2d_finalResults(7, 0) = "Giving" arr2d_finalResults(7, 1) = scoreGiving arr2d_finalResults(8, 0) = "Healing" arr2d_finalResults(8, 1) = scoreHealing arr2d_finalResults(9, 0) = "Knowledge" arr2d_finalResults(9, 1) = scoreKnowledge arr2d_finalResults(10, 0) = "Leadership" arr2d_finalResults(10, 1) = scoreLeadership arr2d_finalResults(11, 0) = "Pastoring" arr2d_finalResults(11, 1) = scorePastoring arr2d_finalResults(12, 0) = "Prophecy" arr2d_finalResults(12, 1) = scoreProphecy arr2d_finalResults(13, 0) = "Serving" arr2d_finalResults(13, 1) = scoreServing arr2d_finalResults(14, 0) = "Teaching" arr2d_finalResults(14, 1) = scoreTeaching arr2d_finalResults(15, 0) = "Tongues / Interpretation" arr2d_finalResults(15, 1) = scoreTongues arr2d_finalResults(16, 0) = "Wisdom" arr2d_finalResults(16, 1) = scoreWisdom arr2d_finalResults(17, 0) = "Working Miracles" arr2d_finalResults(17, 1) = scoreWorkingMiracles Sub DualSorter( byRef arrArray, DimensionToSort ) Dim row, j, StartingKeyValue, StartingOtherValue, _ NewStartingKey, NewStartingOther, _ swap_pos, OtherDimension Const column = 1 ' Ensure that the user has picked a valid DimensionToSort If DimensionToSort = 1 then OtherDimension = 0 ElseIf DimensionToSort = 0 then OtherDimension = 1 Else 'Shoot, invalid value of DimensionToSort Response.Write "Invalid dimension for DimensionToSort: " & _ "must be value of 1 or 0." Response.End End If For row = 0 To UBound( arrArray, column ) - 1 'Start outer loop. 'Take a snapshot of the first element 'in the array because if there is a 'smaller value elsewhere in the array 'we'll need to do a swap. StartingKeyValue = arrArray ( row, DimensionToSort ) StartingOtherValue = arrArray ( row, OtherDimension ) ' Default the Starting values to the First Record NewStartingKey = arrArray ( row, DimensionToSort ) NewStartingOther = arrArray ( row, OtherDimension ) swap_pos = row For j = row + 1 to UBound( arrArray, column ) 'Start inner loop. If arrArray ( j, DimensionToSort ) < NewStartingKey Then 'This is now the lowest number - 'remember it's position. swap_pos = j NewStartingKey = arrArray ( j, DimensionToSort ) NewStartingOther = arrArray ( j, OtherDimension ) End If Next If swap_pos <> row Then 'If we get here then we are about to do a swap 'within the array. arrArray ( swap_pos, DimensionToSort ) = StartingKeyValue arrArray ( swap_pos, OtherDimension ) = StartingOtherValue arrArray ( row, DimensionToSort ) = NewStartingKey arrArray ( row, OtherDimension ) = NewStartingOther End If Next End Sub call DualSorter(arr2d_finalResults, 1) For i = UBound(arr2d_finalResults) to LBound(arr2d_finalResults) step -1 theresults = theresults & arr2d_finalResults(i, 0) & " = " & arr2d_finalResults(i, 1) & vbCrLf Next 'sending the email if emailValid = true then Dim mailmsg Set mailmsg = Server.CreateObject("CDONTS.NewMail") mailmsg.From = "xxx" mailmsg.To = "xxx" mailmsg.Subject = email_message & "Assessment Results" & vbCrLf mailmsg.Body = email_message & theresults mailmsg.Send Set mailmsg = Nothing Response.Write "Thank you for participating in the spiritual gifts assessment.<br/>The results you see below have also been sent to your email address." else Response.Write "We're sorry, but the email you have entered does not appear to be valid. Your results are below, however they could not be emailed to your address." end if %> <h4><%=something%></h4> <table cellpadding="3"> <tr> <th align="left">Spiritual Gift</th> <th align="left">Score</th> </tr> <% for i = UBound(arr2d_finalResults) to LBound(arr2d_finalResults) step -1 %> <tr> <td><%=arr2d_finalResults(i, 0)%></td> <td align="center"><%=arr2d_finalResults(i, 1)%></td> </tr> <% next %> </table> </body> </html>
  359. Last edited by peter_budo : 19 Hours Ago at 1:00 pm. Reason: Closing tag is
insted of [\code]
AddThis Social Bookmarking Widget
Reply With Quote Multi-Quote This Message


[/code]
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Chilisoft ASP script for my church - I need help

 
0
  #3
Feb 7th, 2008
Ok, a couple things.

First, a question: Do you mean that you are receiving an email, but just blank? And then the screen is blank after sending the email?

Second: It should print the line that you requested, but almost at the end of your page, right above your score and your gift. You should always put response.write in correct format:
  1. response.write ("....")
  2. not
  3. response.write "...."
Although that is probably not the problem, it can cause problems later depending on your version of ASP.

CDONTS is basically obsolete. You should change your current email format to this:
  1. Set cdoConfig = CreateObject("CDO.Configuration")
  2.  
  3. With cdoConfig.Fields
  4. .Item(cdoSendUsingMethod) = cdoSendUsingPickup
  5. .Item(cdoSMTPServer) = "PLACEYOURSMTPSERVERADDRESSHERE"
  6. .Update
  7. End With
  8.  
  9. Set cdoMessage = CreateObject("CDO.Message")
  10.  
  11. With cdoMessage
  12. Set .Configuration = cdoConfig
  13. .From = "sentbyemail@email.com"
  14. .To = "sendtoemail@email.com"
  15. .Subject = ""
  16. .TextBody = "yourbodytext"
  17. .Send
  18. End With
  19.  
  20. Set cdoMessage = Nothing
  21. Set cdoConfig = Nothing
CDONTS has a ton of bugs, and you prolly hit one. You can also debug your current EMAIL by replacing the body text with something static like "Testing body text" and send it to yourself. If that works and you change it back just to find your email is blank again, there is a problem where you are assigning it to the bodytext. Hence, your array would be your problem.

Try a little debugging on that end first and let me know.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC