Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / January 2008

Tip: Looking for answers? Try searching our database.

CDOSYS not getting user input from form (Response.form)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
charmut - 09 Jan 2008 06:40 GMT
I have a simple HTML form on my website.I`m posting this form via CDOSDYS to
an email address.The problem is that none of the user input is sent i.e the
email arrives with the following:
Lead:
Telephone:
Email:
Country:
Enquiry:
Time:

My HTML form is as follows:

<form name="enquiry" id="enquiry" action="cdosys.asp" method="get">
<p class="level1_headings">Please use this feedback form to leave your
comments.</P>
<p class="bodytext">
Your name: <br>
<input type="text" name="lead" size="35"><br>
Telephone:<br>
<input type="text" name="telephone" size="35">
<br>
Your e-mail address:<br>
<input type="text" name="email" size="35">
<br>
Country:<br>
<select name="Country" size="1">
<option selected>South Africa</option>           
<option value=Rest of the world>Rest of the world</option>
</select>
<p class="bodytext">
Your Comments:<br>
<textarea name="comments" rows="3" cols="50" wrap="physical"></textarea>
<p class="bodytext">
What time can we call you?<br>
<input type="radio" name="time" value="morning"> 08.00-12.00hrs
<input type="radio" name="time" value="afternoon"> 12.00-16.00hrs
<input type="radio" name="time" value="evening">16.00 to 22.00hrs
<br><br>
<input type="submit" value="send">
<input type="reset" value="reset">   
</form>

The CDOSYS asp page is  as follows:
<%
Const cdoSendUsingMethod
="http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSMTPServer
="http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort
="http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout
="http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate
="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"

Dim objConfig
Dim objMessage
Dim Fields

'Declare variables
Dim lead
Dim telephone
Dim email
Dim country
Dim enquiry
Dim time

    name = Request.Form("lead")
    Response.Write(lead)
    telephone = Request.Form("telephone")
    Response.Write(telephone)
    email = Request.Form("email")
    Response.Write(email)
    country = Request.Form("country")
    Response.Write(country)
    enquiry = Request.Form("enquiry")
    Response.Write(enquiry)
    time = Request.Form("time")
    Response.Write(time)
   
TextBody = "Name: "& lead & vbcrlf
TextBody = TextBody & "Telephone: "& telephone & vbcrlf
TextBody = TextBody & "Email: "& email & vbcrlf
TextBody = TextBody & "Country: "& country & vbcrlf
TextBody = TextBody & "Enquiry: "& enquiry & vbcrlf
TextBody = TextBody & "Time: "& time & vbcrlf
   
   
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields

With Fields
 .Item(cdoSendUsingMethod) = 2
 .Item(cdoSMTPServer) = "localhost"
 .Item(cdoSMTPServerPort) = 25
 .Item(cdoSMTPConnectionTimeout) = 10
 .Update
End With

Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig

 

With objMessage
 .To = "User <mutasatc@gmail.com>"
 .CC = "User <mutasatc@gmail.com>"
 .From = "User <mutasatc@gmail.com>"
 .Subject = "Lordsec Website Enquiry"
 .TextBody = TextBody
     .Send
End With

Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
response.redirect("http://www.lordsec.co.za/thankyou.htm")
%>
Anthony Jones - 09 Jan 2008 21:41 GMT
> I have a simple HTML form on my website.I`m posting this form via CDOSDYS to
> an email address.The problem is that none of the user input is sent i.e the
[quoted text clipped - 111 lines]
> response.redirect("http://www.lordsec.co.za/thankyou.htm")
> %>

This is a classic ASP question and ought to have been posted to
microsoft.public.inetserver.asp.general.

However in answer to your question.  Change the <form> element to use
method="post" instead of "get".  The "get" places all the values on the
query string and are therefore only accessible via Request.Querystring.
Very few circumstances ought to use a "get" so you should use "post".

Signature

Anthony Jones - MVP ASP/ASP.NET


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.