Forum Moderators: open

Message Too Old, No Replies

asp email problems

how come my variables arent showing up.

         

fscanf

8:01 pm on Oct 23, 2003 (gmt 0)

10+ Year Member



Hi, I have a question here. I am using a web-based form to send an email with the results of that form in the email itself.

The form action goes to the asp page where the mail object is created then the email is sent.

My problem is that none of the data is in the email when i recieve it. All the fields have no data in them. Any suggestions will be appreciated.

Thanks

WebJoe

8:47 pm on Oct 23, 2003 (gmt 0)

10+ Year Member



The form action goes to the asp page where the mail object is created then the email is sent.

can you post that code? I'd help me help you make a lot easier.

fscanf

11:16 pm on Oct 23, 2003 (gmt 0)

10+ Year Member



Ok, sure... Here is the first line of the form code. It calls confirmation.asp

<form name="WorkForUs" method="Post" action="confirmation.asp" enctype="multipart/form-data">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="420" id="AutoNumber1">
<tr>
<td width="168"><i><b>Name:</b></i></td>
<td width="253" colspan="2"><input type="text" name="Name" size="35"></td>
</tr>
<tr>
<td width="168"><i><b>Age:</b></i></td>
<td width="253" colspan="2"><input type="text" name="Age" size="35"></td>
</tr>
<tr>
<td width="168"><i><b>Height:</b></i></td>
<td width="253" colspan="2"><input type="text" name="Height" size="35"></td>
</tr>
<tr>
<td width="168"><i><b>Weight:</b></i></td>
<td width="253" colspan="2"><input type="text" name="Weight" size="35"></td>
</tr>
<tr>
<td width="168"><i><b>Area that you live in:</b></i></td>
<td width="253" colspan="2"><input type="text" name="Area" size="35"></td>
</tr>
<tr>
<td width="168"><i><b><br>
Have you worked before?<br>
</b></i></td>
<td width="127" align="center"><b><i>
<input type="radio" value="0" name="Agency">No</i></b></td>
<td width="126" align="center"><b><i>
<input type="radio" name="Agency" value="1">Yes</i></b></td>
</tr>
<tr>
<td width="168"><i><b>Email address:</b></i></td>
<td width="253" colspan="2"><input type="text" name="Email" size="35"></td>
</tr>
<tr>
<td width="168"><i><b>Phone number:</b></i></td>
<td width="253" colspan="2"><input type="text" name="Phone" size="35"></td>
</tr>
<tr>
<td width="168"><b><i>Picture 1:</i></b></td>
<td width="253" colspan="2"><input type="file" name="File1" size="22"></td>
</tr>
</table>
</center>
</div>
<p align="center">
<input type="submit" name="Submit" value="Submit"><input type="reset" value="Reset" name="Reset"></p>
</form>

Here is the ASP code for the email:

<%
DIM strName, strAge, strHeight, strWeight, strArea, strAgency
DIM strEmail, strPhone, strChoice, objMail

strName = request("Name")
strAge = request("Age")
strHeight = request("Height")
strWeight = request("Weight")
strArea = request("Area")
strAgency = request("Agency")
strEmail = request("Email")
strPhone = request("Phone")

IF strAgency = 1 THEN StrChoice = "Yes" ELSE StrChoice = "No" End IF

Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = "someone@domain.com"
objMail.Subject = "Test information with asp email page"
objMail.To = "someone@domain.com"
objMail.Body = "Name: " & strName & vbCrLf & _
"Age: " & strAge & vbCrLf & _
"Height: " & strHeight & vbCrLf & _
"Weight: " & strWeight & vbCrLf & _
"Area: " & strArea & vbCrLf & _
"Worked at an agency before: " & StrChoice & vbCrLf & _
"Email address: " & strEmail & vbCrLf & _
"Phone number: " & strPhone

objMail.Send
Set objMail = nothing
%>

By the way, I was using the Request.Form("variablename") in the asp page and it wasn't working either.

Thanks again.

aspdaddy

11:27 pm on Oct 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>enctype="multipart/form-data

If you use this, you need to use an object to request the form values -

Set Uploader = New FileUploader
Uploader.Upload()
D1 = Uploader.Form("D1")

fscanf

11:51 pm on Oct 23, 2003 (gmt 0)

10+ Year Member



Originally, the form was meant to have an upload button, and a file to be attached. I havent started to work on that yet, although I have heard I need to install something like ASPUpload.

To just send the values (w/o uploading) should i change that to "text/plain"?

As you can probably tell. I am pretty new at this.

fscanf

1:24 am on Oct 24, 2003 (gmt 0)

10+ Year Member



I got it working, problem was with the enctype property. Thanks a lot Aspdaddy!