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.

<!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: 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>

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.

<!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: 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>

<!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>

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:

response.write ("....")
not 
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:

Set cdoConfig = CreateObject("CDO.Configuration")  

  With cdoConfig.Fields  
    .Item(cdoSendUsingMethod) = cdoSendUsingPickup
    .Item(cdoSMTPServer) = "PLACEYOURSMTPSERVERADDRESSHERE"  
    .Update  
  End With  

  Set cdoMessage = CreateObject("CDO.Message")  

  With cdoMessage  
    Set .Configuration = cdoConfig  
      .From = "sentbyemail@email.com"
      .To = "sendtoemail@email.com"  
      .Subject = ""
      .TextBody = "yourbodytext"  
      .Send  
  End With  
 
  Set cdoMessage = Nothing  
  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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.