PDA

View Full Version : form will send email but leaves out the variables


andrew1234
04-01-2005, 12:47 PM
Hi Below is the form and the asp email script

it will send the asp email but it wont

display the info that is filled into the form on the e-mail sent.

can you please tell me what i have left out



thanks for the help

Andrew





html form>>>>>


<font size="2" face="Arial, Helvetica, sans-serif">
<FORM action="123.asp" method=POST enctype="text/plain" name="Form" id="Form">
name
<input name="na" type="text" >
<br />
sname
<input name="sname" type="text" >
<br />
tel
<input name="tel" type="text" >
<br />
phone
<input name="phone" type="text" >
<br />
cell
<input name="cell" type="text" >
<br />
email
<input name="email" type="text" >
<br />
<input name="submit" type="submit" value="do it" >
</FORM>
</font>



asp>>>>>>>>>>>>>>>

<%

Set mybody = nothing
'-------------------------------------------------------------------------------------
Dim na, sname, phone, cell ,email

na = Request.Form("na")
sname = Request.Form("sname")
phone = Request.form("phone")
cell = Request.Form("cell")
email = Request.Form("email")
'______________________________________________________________________________
mybody = "" & chr(13) 'chr(13) makes new line
mybody = mybody & "Name : " & na & chr(13) & chr(13)
mybody = mybody & "sname : " & sname & chr(13) & chr(13)
mybody = mybody & "phone : " & phone & chr(13) & chr(13)
mybody = mybody & "cell : " & cell & chr(13) & chr(13)
mybody = mybody & "email : " & email & chr(13) & chr(13)

mybody=mybody & "Test message"


'_______________________________________________________________________________________________


'_______________________________________________________________________________________________

Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.Body=mybody
objMail.From= "1@test.com"
objMail.To="1@test.com"
objMail.Subject="ASP Test message"
objMail.Send
set objMail = nothing

%>
<html>
<head>
<title>Test</title>
</head>
<body>
<b>sent</b>
</body>
</html>

tboss132
04-01-2005, 03:01 PM
What error message exactly is being displayed? Please post that here and we'll be able to help you. At a glance, I don't see anything wrong with your code.

andrew1234
04-01-2005, 05:42 PM
Hi Thanks

there is no error message

it just wont put the stuff filled in the form
eg name e-mail etc in the form

do you have any ideas?

thanks

tboss132
04-02-2005, 04:18 PM
Try changing the enctype on your form to "multipart/form-data". Most likely the problem is with the form. It's not passing values. You can trouble shoot by using response.write and removing all the stuff on the form and leaving only one and see if it'll pass. If it works, then try add them one after the other.

glenngv
04-04-2005, 11:01 AM
Try changing the enctype on your form to "multipart/form-data".
If you do that, Request.Form will not work. That type is only used for uploading. The enctype should be set to application/x-www-form-urlencoded or just don't set it at all as that value is the default.