Request.Form 'and' cdo.message

W

whyyyy

USING IIS 5.1, and Windows XP pro, the following form works on my system,
and I can use as many form elements as I wish, as long as all form elements
have the same name: "words", in this example.

Help -- why can`t I give each form element a different name? Any
suggestions will be gratefully appreciated.

Also,See example at very bottom of something that once worked on a remote
server, but doesn't on IIS 5.1, windows xp pro



<%@LANGUAGE="VBSCRIPT"%>
<%
Dim MyMail
Set MyMail = Server.CreateObject("CDO.Message")
MyMail.TextBody = Request.Form("words")
MyMail.From = "postmaster@localhost"
MyMail.To = "postmaster@localhost"
MyMail.Subject = "CDOSYS for Windows 2000/XP"
MyMail.Send()
Set MyMail = Nothing
%>

<HTML>


<FORM NAME="TextBody" METHOD="post" ACTION="gusto44444444.asp">
<P><BR>
<input type="text" NAME= "words" ID="words" COLS="28" ROWS="1">
Name <br>
<input type="text" NAME= "words" ID="words" COLS="28" ROWS="1">
<SPAN CLASS="book_antigua">E-Mail</SPAN><BR CLEAR="all">
<input type="text" name= "words" id="words" cols="28" rows="1">
Phone</P>
<BR>

<TEXTAREA NAME = "words" ID="words" COLS="18" ROWS="2"
wrap="VIRTUAL"></TEXTAREA>
<SPAN CLASS="book_antigua">Write Here </SPAN><BR CLEAR="all">
<P>
<INPUT TYPE="submit" NAME="Submit" VALUE="Submit, e-mail required"
ALIGN="DEFAULT">
<input type="reset" name="Reset" value="Reset">
</P>
<P>
</P>
<P>

</P>
</FORM>
<%
dim words
words=Request.Form("words")
If words<>"" Then
Response.Write("Thanks " & words & "!<br />")
Response.Write("We'll respond soon")
End If
%>




EXAMPLE AT BOTTOM -- WORKED IN PAST

BUT NOT NOW

Dim myMail
Set myMail = Server.CreateObject("CDONTS.NewMail")

Request.Form("email1")
Request.Form("name")
Request.Form("phone")
Request.Form("words")
 
R

Ray Costanzo [MVP]

You can name your form fields whatever you want, and then access them by
Request.Form("nameOfInput")

MyMail.TextBody = Request.Form("input1") & vbCrLf & Request.Form("input2")

Ray at work
 
A

Aaron Bertrand [SQL Server MVP]

You're directly assigning the entire message body, the values of
request.form("words")

Why don't you do something like:

MessageBody = Request.Form("email1") & vbCrLf & _
Request.Form("name") & vbCrLf & _
Request.Form("phone") & vbCrLf & _
Request.Form("words")

....

MyMail.TextBody = MessageBody



The example you have at the bottom could never have worked. All you do is
create the object and then type out Request.Form("...")... this should yield
a type mismatch error or something.
 
W

whyyyy

Many thanks, Ray

I`ll let you know how it works

& vbCrLf something new for me, as is just about everything

AL
 
W

whyyyy

and thanks Aaron

Aaron Bertrand said:
You're directly assigning the entire message body, the values of
request.form("words")

Why don't you do something like:

MessageBody = Request.Form("email1") & vbCrLf & _
Request.Form("name") & vbCrLf & _
Request.Form("phone") & vbCrLf & _
Request.Form("words")

....

MyMail.TextBody = MessageBody



The example you have at the bottom could never have worked. All you do is
create the object and then type out Request.Form("...")... this should yield
a type mismatch error or something.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top