...

View Full Version : Request.form not getting data from online form



charmut
01-08-2008, 07:01 AM
I hope someone would be able to help me before I pull all my hair out.:confused:

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:
Name:
Telephone:
Email:
Country:
enquiry:
time:

My Form data is:

<form name="enquiry" id="enquiry" method="post" action="cdosys.asp" enctype="text/plain">
<p class="level1_headings">Please use this feedback form to leave your comments.</P>
<p class="bodytext">
Your name: <br>
<input type="text" name="name" 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>
<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>

My 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 name
Dim telephone
Dim email
Dim country
Dim enquiry
Dim time

name = Request.Form("name")
Response.Write(name)
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: "& name & 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")
%>

Spudhead
01-08-2008, 12:55 PM
Take enctype="text/plain" out of your form tag.

ps. it's generally not a good idea to call form fields "name".

charmut
01-08-2008, 04:49 PM
Take enctype="text/plain" out of your form tag.

ps. it's generally not a good idea to call form fields "name".
Thanks.I have taken enctype="text/plain" out of the form.I also renamed the field that I hitherto referred to as "name".Unfortunately the email sent is still missing the user input:
Name:
Telephone:
Email:
Country:
enquiry:
time:

charmut
01-09-2008, 09:45 AM
:D works like a charm now!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum