Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create variables to store array values

Status
Not open for further replies.

trufla

Programmer
Aug 9, 2004
31
GB
Hi,

I am struggling to work out how to grab and contain array values in variables so that they can be used to form an email enquiry. I am knew to checkbox processing and asp arrays in general!

This is my code so far, and it outputs the array values to screen, but I need to put these values into variables somehow so that I can email them out as separate items.

Any help appreciated!

Code:
<%

'Variables for Personal Details
Dim Name
Dim Date
Dim Venue

'Variables for email particulars
Dim sMsg 
Dim sTo 
Dim sFrom 
Dim sSubject 
Dim sTextBody 

Name = request.form("audio_name")
Date = request.form("audio_date")
venue = request.form("audio_venue")


'Variables for checkboxes array
Dim mode,mode_a,i

'Used audio as common name for all the checkboxes with different values so they will be treated as a group of checkboxes
mode = request.form("audio")

'Split the string to get the array of checked values. 
mode_a=split(mode,",")

'Loop through the array by using for for loop and UBound function to print out the checked values of the checkboxes. 
'LBound and UBound determine the min and max length of the array, useful for looping.

For i=LBound(mode_a) to UBound(mode_a)

Response.Write mode_a(i) + "<br>"

Next


'sTo = "somewhere@somewhere.com"
'sFrom = "somewhere@somewhere.com"
'sSubject = "Enquiry"
'sTextBody = "An enquiry was made by " & Name & " on " & Date & " for " & Venue


'Dim objMail
'Create the mail object 
'Set objMail = Server.CreateObject("CDO.Message")

'Set key properties 
'objMail.From = sFrom 
'objMail.To = sTo 
'objMail.Subject= sSubject 
'objMail.TextBody = sTextBody 

'Send the email 
'objMail.Send 

'Clean-up mail object
'Set objMail = Nothing
%>
 
Don't think I want to do that actually,

I think I need to do somethign like this:

Code:
Dim EmailBody

For i=LBound(mode_a) to UBound(mode_a)

EmailBody = mode_a(i)

However, the array simply overwrites the values so only the last one is output. How can I Add each value to EmailBody without overwriting previous values?
 
neemind, I realised it is EmaiBody = EmailBody & mode_a(i), not +
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top