[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

=?Utf-8?B?cm9kY2hhcg==?=

4/21/2004 6:32:00 PM

I am working on sending form results to email with ASP
code. I had it working ok until I tried to build the body
of the email. There are several fields on the form and I
want to build the body of the email by showing only the
fields that were filled in by the user (don't show null
ones)

I am doing it like this:

Dim strBody

If Request.Form("Outlook") <> "" Then
strBody = strBody & "Outlook : "
strBody = strBody & Request.Form("Outlook") & Chr(13)
End if

......

And I repeat the IF statements for each field on the form
in order to build the body of the email. For some reason,
it's not working.

Am I coding the IF statements correctly?

Thanks
Bonnie
3 Answers

Kevin Spencer

4/21/2004 7:51:00 PM

0

Hi Bonnie,

Your If statement looks fine, but that's all I can say about it until you
describe what you mean by "not working".

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Bonnie" <anonymous@discussions.microsoft.com> wrote in message
news:23f701c427ce$f148e8d0$a601280a@phx.gbl...
> I am working on sending form results to email with ASP
> code. I had it working ok until I tried to build the body
> of the email. There are several fields on the form and I
> want to build the body of the email by showing only the
> fields that were filled in by the user (don't show null
> ones)
>
> I am doing it like this:
>
> Dim strBody
>
> If Request.Form("Outlook") <> "" Then
> strBody = strBody & "Outlook : "
> strBody = strBody & Request.Form("Outlook") & Chr(13)
> End if
>
> .....
>
> And I repeat the IF statements for each field on the form
> in order to build the body of the email. For some reason,
> it's not working.
>
> Am I coding the IF statements correctly?
>
> Thanks
> Bonnie


=?Utf-8?B?cm9kY2hhcg==?=

4/21/2004 8:07:00 PM

0

Where is the script "not working"? Or more exactly, what
is not happening?
>-----Original Message-----
>I am working on sending form results to email with ASP
>code. I had it working ok until I tried to build the body
>of the email. There are several fields on the form and I
>want to build the body of the email by showing only the
>fields that were filled in by the user (don't show null
>ones)
>
>I am doing it like this:
>
>Dim strBody
>
>If Request.Form("Outlook") <> "" Then
>strBody = strBody & "Outlook : "
>strBody = strBody & Request.Form("Outlook") & Chr(13)
>End if
>
>......
>
>And I repeat the IF statements for each field on the form
>in order to build the body of the email. For some reason,
>it's not working.
>
>Am I coding the IF statements correctly?
>
>Thanks
>Bonnie
>.
>

Jon Spivey

4/22/2004 1:31:00 PM

0

Hi Bonnie

That code looks fine - what's going wrong?

The way you're doing it is the long way around though - you don't need to
check each field individually you can just loop through all the fields and
add the ones that arent blank, eg

<%
for i = 1 to request.form.count
if request.form.item(i) <> "" then
strBody = strBody & request.form.key(i) & " = " & request.form.item(i) &
vbcrlf
end if
next
%>


--
Cheers,
Jon
Microsoft MVP - FP

Bonnie wrote:
> I am working on sending form results to email with ASP
> code. I had it working ok until I tried to build the body
> of the email. There are several fields on the form and I
> want to build the body of the email by showing only the
> fields that were filled in by the user (don't show null
> ones)
>
> I am doing it like this:
>
> Dim strBody
>
> If Request.Form("Outlook") <> "" Then
> strBody = strBody & "Outlook : "
> strBody = strBody & Request.Form("Outlook") & Chr(13)
> End if
>
> .....
>
> And I repeat the IF statements for each field on the form
> in order to build the body of the email. For some reason,
> it's not working.
>
> Am I coding the IF statements correctly?
>
> Thanks
> Bonnie