hornblower
09-23-2003, 05:17 PM
I have set up a form within a site using ASP. Whilst the form works OK the order of the form responses is jumbled up when people respond. Can anyone suggest an answer to this problem. Thank you.
|
Click to See Complete Forum and Search --> : Order of items in form hornblower 09-23-2003, 05:17 PM I have set up a form within a site using ASP. Whilst the form works OK the order of the form responses is jumbled up when people respond. Can anyone suggest an answer to this problem. Thank you. Ribeyed 09-23-2003, 05:24 PM hi, what code are you using to request the form elements? hornblower 09-24-2003, 02:57 PM I am using what I suspect to be a very basic form handling code supplied by Redstation for their Windows 2000 servers! From what I have been able to gather this is like Dimac W3 Jmail. <%@ Language=VBScript %> <% Option Explicit Response.Buffer = true Response.Expires = -1000 Dim JMail, emailmsg, thing, msg %> <html> Amend the Recipient, Subject and redirected page below. if (Request.Form("Submit")) = "Submit Request" then emailmsg = "" for each thing in request.form emailmsg = emailmsg & trim(thing) & ": " & trim(request.form(thing)) & vbcrlf next set msg = Server.CreateOBject( "JMail.Message" ) msg.Logging = true msg.silent = false msg.From = request.form("email") msg.AddRecipient "name@your-domain.com" 'Recipient of emailed form msg.Subject = "Test Subject" 'Subject of Email msg.Body = cstr(EmailMsg) msg.Send( "www2.redstation.co.uk" ) 'Change this to www2, www3 etc response.redirect "thankyou.htm" 'address of thank you page end if Sorry if this is too much info, as you may gather I am fairly new to this! Thanks for your help Ribeyed 09-24-2003, 04:55 PM hi, ok thats what i thought you were using. If you use request.item the form elements come through random as you already know, however the form elements are numbered so you can use count and then request by number of element in the form. code change here for you: <%@ Language=VBScript %> <% Option Explicit Response.Buffer = true Response.Expires = -1000 Dim JMail, emailmsg, thing, msg, thevalue %> <html> Amend the Recipient, Subject and redirected page below. if (Request.Form("Submit")) = "Submit Request" then emailmsg = "" for i = 0 to request.form.count() thing = request.form.key(i) thevalue = request.form.item(i) emailmsg = emailmsg & trim(thing) & ": " & trim(thevalue) & vbcrlf next set msg = Server.CreateOBject( "JMail.Message" ) msg.Logging = true msg.silent = false msg.From = request.form("email") msg.AddRecipient "name@your-domain.com" 'Recipient of emailed form msg.Subject = "Test Subject" 'Subject of Email msg.Body = cstr(EmailMsg) msg.Send( "www2.redstation.co.uk" ) 'Change this to www2, www3 etc response.redirect "thankyou.htm" 'address of thank you page end if ok that should work, can't test it but it should work. All i have done is counted the form elements and loop that amount of times pulling out the elements in order they appear on the form. hornblower 09-24-2003, 06:38 PM Thanks for your prompt reply, have amended code as suggested but am getting following error message at bottom of page: Microsoft VBScript runtime error '800a01f4' Variable is undefined: 'i' /html/forms/application.asp, line 521 Ribeyed 09-24-2003, 06:40 PM hi, ok no problem you just need to defind the variable called i : <% Option Explicit Response.Buffer = true Response.Expires = -1000 Dim JMail, emailmsg, thing, msg, thevalue, i %> hornblower 09-24-2003, 06:48 PM Sorry about this have defined i but get following message: Request object error 'ASP 0105 : 80004005' Index out of range /html/forms/application.asp, line 522 An array index is out of range. Ribeyed 09-24-2003, 06:50 PM the reason is not clear from the information you have provided. Which line is 522? Ribeyed 09-24-2003, 06:53 PM hi, try this: for i = 1 to request.form.count() i = 1 not i = 0 hornblower 09-24-2003, 06:58 PM Line 522 appears to be - thing = request.form.key(i) hornblower 09-24-2003, 07:02 PM Hi Changing from zero to 1 seems to have done the trick! Really appreciate your help - thanks Ribeyed 09-25-2003, 02:27 AM good, :D webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |