PDA

View Full Version : CDONTS Question


phillip_ewing
03-11-2003, 01:15 AM
When I try to pass the Select answer to the CDONTS, it does not write to the e-mail. Can someone please tell me what I am doing wrong? I was asked to name the select statement but it too did not work.



code:--------------------------------------------------------------------------------
<TR valign="middle">
<TD ALIGN="right" WIDTH="278">This is reference to?:
<TD WIDTH="278">
<SELECT size="1" class="input" name="u_reference">
<OPTION value="Test"<% If Request.Form("u_reference") = "Test" Then Response.Write(" selected=""selected""") %> >Test</option>
<OPTION value="Test1"<% If Request.Form("u_reference") = "Test1" Then Response.Write(" selected=""selected""") %> >Test1</option>
</SELECT>
</TD></td>
</TR>

response.write "<br><b>This is reference to?: " & u_reference & "<br>"

MessageBody = MessageBody & "This is reffeence to?: " & u_reference & vbCrLf

Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.To = u_email
objMail.From = "auto_mail@80sretromusic.com"
objMail.Subject = "A Feedback/Contact Form has been submitted."
objMail.Body = MessageBody objMail.Send
Set objMail = Nothing

end if %>
--------------------------------------------------------------------------------
Please note u_email is defined. It is just not listed.

Thank you in advance, Phillip

whammy
03-11-2003, 01:24 AM
Are you posting the form back to itself before you try to send the email? Or is it on the same page, as displayed?

If the latter, that won't work since you can't use Request.Form() since the form hasn't been submitted. In that case you'd need to submit the form again, and see if u_reference has a value.

Either that, or put it on the page that submits to this one.

phillip_ewing
03-11-2003, 02:20 AM
Whammy,

I do not understand. Can you reelaborate? I attached the form in hopes that you can look at it. Please tell me what I am doing wrong with this form?

Thanks, Phillip

phillip_ewing
03-11-2003, 02:54 AM
Can you resubmit that post? I did not get it.

Thanks, Phillip

whammy
03-11-2003, 02:56 AM
Sorry to confuse, I deleted your other thread since it was identical. ;)

Since that post was very far down the chain, it's likely that noone would have ever responded, and this thread contains the exact same thing - I was careful to make sure of that, since I don't delete posts very often, I just made the mistake of responding to it first (which resulted in you getting emailed- sorry about that).

whammy
03-11-2003, 03:00 AM
Ok, that IS the problem...

You're trying to send an email from the same page that has the select box in it.

You can't get that value (from the select box) unless you post it to the server, using ASP.

In order to get a variable from a form in ASP, it has to be sent to the server (which this isn't) - so that value will NEVER be in the email - no additional information was sent to the server... see?

Take a look at how all of the other values get there... they are posted from another page.

:)