Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Form to Email

Reply
Thread Tools

Form to Email

 
 
David
Guest
Posts: n/a
 
      10-25-2006
Hi,

I have some database records which are listed out in a table on an asp
page.
The table is within a <form> tag.
At the end of each record (and table row), I have created a <select>
dropdown box to appear.

The user selects an item for each record in the list, then hits submit.

The following code is used to create the body of the email:

For Each i in Request.Form
MailBody = MailBody & Request.Form(i) & vbcrlf
Next

What I need in the body is the first database field printed on the form
in each record and the selected item from the dropdown against that
record

i.e.

Product A Yes
Product B No
Product C Yes

I have tried adding a hidden input type to carry the Product Code but
all I get is the following as my email body:

Select Status, Select Status, Select Status, Approved, Select Status,
Select Status, Select Status, Approved, Select Status, Select Status,
Approved, Select Status, Select Status
070512001R, 069435001Q, 069424001Q, 069321001Q, 069305001Q, 069270001Q,
069167001Q, 068744001Q, 068677001Q, 068677001Q, 068466001Q, 066497001Q,
061097001Q
Submit

Where 'Select Status' is the default text to show in the dropdown.

It first goes through all the dropdown results, and them through all
the product codes and for some reason, the vbcrlf is not working ? How
can I print them together in sets ?

I need the body to show

070512001R = Approved
069435001Q = Approved

etc

PLEASE CAN YOU HELP ME DO THIS, THANKS

Thanks

David

 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      10-25-2006
Can you post the HTML portion of your form, or just a sampling of a few rows
from the table at least?

Ray at work

"David" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> Hi,
>
> I have some database records which are listed out in a table on an asp
> page.
> The table is within a <form> tag.
> At the end of each record (and table row), I have created a <select>
> dropdown box to appear.
>
> The user selects an item for each record in the list, then hits submit.
>
> The following code is used to create the body of the email:
>
> For Each i in Request.Form
> MailBody = MailBody & Request.Form(i) & vbcrlf
> Next
>
> What I need in the body is the first database field printed on the form
> in each record and



 
Reply With Quote
 
 
 
 
Mike Brind
Guest
Posts: n/a
 
      10-25-2006
"David" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> Hi,
>
> I have some database records which are listed out in a table on an asp
> page.
> The table is within a <form> tag.
> At the end of each record (and table row), I have created a <select>
> dropdown box to appear.
>
> The user selects an item for each record in the list, then hits submit.
>
> The following code is used to create the body of the email:
>
> For Each i in Request.Form
> MailBody = MailBody & Request.Form(i) & vbcrlf
> Next
>
> What I need in the body is the first database field printed on the form
> in each record and the selected item from the dropdown against that
> record
>
> i.e.
>
> Product A Yes
> Product B No
> Product C Yes
>
> I have tried adding a hidden input type to carry the Product Code but
> all I get is the following as my email body:
>
> Select Status, Select Status, Select Status, Approved, Select Status,
> Select Status, Select Status, Approved, Select Status, Select Status,
> Approved, Select Status, Select Status
> 070512001R, 069435001Q, 069424001Q, 069321001Q, 069305001Q, 069270001Q,
> 069167001Q, 068744001Q, 068677001Q, 068677001Q, 068466001Q, 066497001Q,
> 061097001Q
> Submit
>
> Where 'Select Status' is the default text to show in the dropdown.
>
> It first goes through all the dropdown results, and them through all
> the product codes and for some reason, the vbcrlf is not working ? How
> can I print them together in sets ?
>
> I need the body to show
>
> 070512001R = Approved
> 069435001Q = Approved
>


Basic HTML. You need to provide different names to each of your select
lists so that they can be identified uniquely. Where you have a default
text in the drop down, make sure its value is set to an empty string eg
<option value="">Select Status</option>. If you don't provide a value
attribute for an option, it picks up on whatever the option is. If you
provide the same name to all your select lists, they will be passed in a
comma-delimited string (which makes parsing the results more difficult).

--
Mike Brind


 
Reply With Quote
 
David
Guest
Posts: n/a
 
      10-25-2006
Ray,

Here is the line which prints out the records within a loop in my asp
page:

response.write "<td align=center><A
HREF=BBUSA_Repair_Lab_Datacheck.asp?SDLink=" & RS("ReportID") & ">" &
ref & "</a></td><td>&nbsp;&nbsp;&nbsp;</td><td align=center>" & part &
"</td><td>&nbsp;&nbsp;&nbsp;</td><td align=center>" & serial &
"</td><td>&nbsp;&nbsp;&nbsp;</td><td align=left>" & cause &
"</B></td><td align=LEFT>" & money & "</B></td><TD>" & FD &
"</TD><input TYPE=hidden name=PO VALUE=" & ref & "></tr>"

The variables 'ref', 'part', 'serial', 'cause', 'money' might be text
strings or database records.

The <select tag> against each record is defined in the top of the page
and set to a variable called FD, which is on the bottom line of the
code above

<TD>" & FD & "</TD>

FD = "<select name=select><option>Approved</option><option>Not
Approved</option><option>Scrap at your location</option><option
selected>Select Status</option></select>"

I cannot name each select tag seperately as there is only 1, and the
asp repeats it for each record in the loop.

If you can suggest a better way to go about this i'm all ears and
really appreciate your advise and help, thanks so much.

 
Reply With Quote
 
David
Guest
Posts: n/a
 
      10-25-2006
Mike,

Thanks for your advise. I only have 1 select statement. Please see my
reply to Ray.

David

 
Reply With Quote
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      10-25-2006
Can you post the HTML, I mean? Not the ASP code.

Thanks,

Ray at work

"David" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> Ray,
>
> Here is the line which prints out the records within a loop in my asp
> page:
>
> response.write "<td align=center><A
> HREF=BBUSA_Repair_Lab_Datacheck.asp?SDLink=" & RS("ReportID") & ">" &
> ref & "</a></td><td>&nbsp;&nbsp;&nbsp;</td><td align=center>" & part &
> "</td><td>&nbsp;&nbsp;&nbsp;</td><td align=center>" & serial &
> "</td><td>&nbsp;&nbsp;&nbsp;</td><td align=left>" & cause &
> "</B></td><td align=LEFT>" & money & "</B></td><TD>" & FD &
> "</TD><input TYPE=hidden name=PO VALUE=" & ref & "></tr>"
>
> The variables 'ref', 'part', 'serial', 'cause', 'money' might be text
> strings or database records.
>
> The <select tag> against each record is defined in the top of the page
> and set to a variable called FD, which is on the bottom line of the
> code above
>
> <TD>" & FD & "</TD>
>
> FD = "<select name=select><option>Approved</option><option>Not
> Approved</option><option>Scrap at your location</option><option
> selected>Select Status</option></select>"
>
> I cannot name each select tag seperately as there is only 1, and the
> asp repeats it for each record in the loop.
>
> If you can suggest a better way to go about this i'm all ears and
> really appreciate your advise and help, thanks so much.
>



 
Reply With Quote
 
David
Guest
Posts: n/a
 
      10-25-2006
I have sent the pages to you direct, hope this is ok.

 
Reply With Quote
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      10-25-2006
Can you post the HTML? Just load the page in your browser and do a
view-source to get it.

Ray at work

"David" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
>I have sent the pages to you direct, hope this is ok.
>



 
Reply With Quote
 
David
Guest
Posts: n/a
 
      10-25-2006

<HTML>

<head>


<style type="text/css">



ul#split,ul#split li{margin:0;padding:0;list-style:none}
ul#split li{float:CENTER;width:1100px;margin:0 10px 10px 0}
ul#split h3{font: normal 90%/1.0 Verdana,sans-serif;
text-transform:uppercase;margin:0px;padding: 5px 5px
5px;text-align:CENTER;color: #000}
ul#split p{margin:0;padding:5px 8px 5px}
ul#split div{background:#C5E6F6}
li#one h3{background: #C8C866}
li#two h3{background: #FFBD00}
li#three h3{background: #E3A1C4}
</style>
<script type="text/javascript" src="niftycube.js"></script>
<script type="text/javascript">
window.onload=function(){
Nifty("ul#split h3","top");
Nifty("ul#split div","bottom same-height");
Nifty("div#box","big");
}
</script>

</head>


<BODY bgcolor="#FFFFCC">







<center>



<%




FD = "<select name=select><option>Approved</option><option>Not
Approved</option><option>Scrap at your location</option><option
selected>Select Status</option></select>"


info = "Received at Scene Double"

strquery = "SELECT reports.Charges, reports.BB_Approval,
reports.ReportID, reports.CustomerID, reports.ReportDate,
reports.DateReturned, reports.YourPart, reports.YourRef,
'reports.Firmware Version', 'reports.Hardware Version',
reports.FaultReported, reports.FaultDescription, 'reports.Fault Found',
reports.Cause, reports.ActionTaken, reports.BoxContents,
reports.Comments, reports.GeneralNotes, reports.EditRefurbNotes,
reports.Customer, reports.Serial, reports.Country, reports.RepairSite,
reports.Job, reports.Warranty, reports.Charges, reports.ReportTS,
reports.RefurbSerial, reports.LocalFW, reports.RemoteFW,
reports.ReceivedDate, reports.Status, reports.StatusNotes FROM reports"
strquery = strquery & " WHERE ((reports.BB_Approval='Awaiting
Approval') and (reports.CustomerID=13)) ORDER BY reports.YourRef
DESC,reports.Serial;"




Set RS = adoDataConn.Execute(strquery)



if RS.EOF then


response.write "All repairs at Scene Double have either been Approved
or Shipped back to you" & vbcrlf & "Please use our search facility for
locating specific repairs"




else


RESPONSE.WRITE "<ul id=split>"
RESPONSE.WRITE "<li id=one><h3>-- Repairs currently in progress at
Scene Double --</H3>"
RESPONSE.WRITE "<div><form name=Approval method=post
action=processemail_approval.asp>"



response.write "<table><tr><td align=center><b>Your
PO#</TD><td>&nbsp;&nbsp;&nbsp;</td><TD align=center><b>Part
Code</td><td>&nbsp;&nbsp;&nbsp;</td><td align=center><b>Serial
Number</td><td>&nbsp;&nbsp;&nbsp;</td><td
align=center><b>Status</td><td align=center><b>Charge</td></tr><tr>"

do while NOT RS.EOF

If RS("Cause") = "" or isnull(RS("Cause")) then
cause = "Unknown Cause"
else
cause = RS("Cause")
end if


If RS("YourRef") = "" or isnull(RS("YourRef")) then
ref = "Unknown PO#"
else
ref = RS("YourRef")
end if

If RS("YourPart") = "" or isnull(RS("YourPart")) then
part = "Unknown Product Code"
else
part = RS("YourPart")
end if

If RS("Serial") = "" or isnull(RS("Serial")) then
serial = "No Serial Number"
else
serial = RS("Serial")
end if

If RS("Status") = "" or isnull(RS("Status")) then
status = "Currently Unknown"
else
status = RS("Status")
end if


'-------------- BEGIN CHARGES ------------------

if RS("Charges") = "" or ISNULL(RS("Charges")) then
money = "Awaiting"

elseif RS("Charges") = "FOC" then
money = "FOC"

else
money = RS("Charges")

'money = "<a href='#'
onclick=window.open('http://www.ozforex.com.au/tools/customConvert.asp?NC_ID1=GBP&NC_ID2=USD&BG=1C8CB3& amount="
& CINT(RS("Charges")) &
"&l=www.ozforex.com.au/images/tools/fxTranzfers.gif','ozforexWin','toolbar=no,menubar= no,scrollbars=no,resizable=no,status=no,location=n o,directories=no,copyhistory=no,dependent=0,height =360,width=250');
return false; onMouseOver=status='Launch Sample'; return true"
onMouseOut=status='';return true>OzForex Currency Converter</a>"


'money = CH & "<script
src=http://coinmill.com/frame.js></script><script>var
currency_round=true;</script> GBP (approx
$<script>currency_show_conversion(" & CH & ",'GBP','USD');</script>
USD)"

END IF

'-------------- END CHARGES ------------------







If RS("YourRef") = "" or isnull(RS("YourRef")) then

response.write "<td align=center>" & ref &
"</td><td>&nbsp;&nbsp;&nbsp;</td><td align=center>" & part &
"</td><td>&nbsp;&nbsp;&nbsp;</td><td align=center>" & serial &
"</td><td>&nbsp;&nbsp;&nbsp;</td><td align=left>" & cause &
"</B></td><td align=LEFT>" & money & "</B></td></tr>"

else

response.write "<td align=center><A
HREF=BBUSA_Repair_Lab_Datacheck.asp?SDLink=" & RS("ReportID") & ">" &
ref & "</a></td><td>&nbsp;&nbsp;&nbsp;</td><td align=center>" & part &
"</td><td>&nbsp;&nbsp;&nbsp;</td><td align=center>" & serial &
"</td><td>&nbsp;&nbsp;&nbsp;</td><td align=left>" & cause &
"</B></td><td align=LEFT>" & money & "</B></td><TD>" & FD &
"</TD><input TYPE=hidden name=PO VALUE=" & ref & "></tr>"

end if






rs.movenext

Loop




end if


RESPONSE.WRITE "</TABLE></div></LI></UL><input type=reset name=Reset
value=Reset><input type=submit name=Submit value=Submit></form>"




%>



</font>
</body>

</html>

 
Reply With Quote
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      10-25-2006
Dave, load the page in your browser and do a view-source! This is still the
ASP code!

Ray at work

"David" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
>
> <HTML>
>
> <head>
>
>
> <style type="text/css">
>
>
>
> ul#split,ul#split li{margin:0;padding:0;list-style:none}
> ul#split li{float:CENTER;width:1100px;margin:0 10px 10px 0}
> ul#split h3{font: normal 90%/1.0 Verdana,sans-serif;
> text-transform:uppercase;margin:0px;padding: 5px 5px
> 5px;text-align:CENTER;color: #000}
> ul#split p{margin:0;padding:5px 8px 5px}
> ul#split div{background:#C5E6F6}
> li#one h3{background: #C8C866}
> li#two h3{background: #FFBD00}
> li#three h3{background: #E3A1C4}
> </style>
> <script type="text/javascript" src="niftycube.js"></script>
> <script type="text/javascript">
> window.onload=function(){
> Nifty("ul#split h3","top");
> Nifty("ul#split div","bottom same-height");
> Nifty("div#box","big");
> }
> </script>
>
> </head>
>
>
> <BODY bgcolor="#FFFFCC">
>
>
>
>
>
>
>
> <center>
>
>
>
> <%
>
>
>
>
> FD = "<select name=select><option>Approved</option><option>Not
> Approved</option><option>Scrap at your location</option><option
> selected>Select Status</option></select>"
>
>
> info = "Received at Scene Double"
>
> strquery = "SELECT reports.Charges, reports.BB_Approval,
> reports.ReportID, reports.CustomerID, reports.ReportDate,
> reports.DateReturned, reports.YourPart, reports.YourRef,
> 'reports.Firmware Version', 'reports.Hardware Version',
> reports.FaultReported, reports.FaultDescription, 'reports.Fault Found',
> reports.Cause, reports.ActionTaken, reports.BoxContents,
> reports.Comments, reports.GeneralNotes, reports.EditRefurbNotes,
> reports.Customer, reports.Serial, reports.Country, reports.RepairSite,
> reports.Job, reports.Warranty, reports.Charges, reports.ReportTS,
> reports.RefurbSerial, reports.LocalFW, reports.RemoteFW,
> reports.ReceivedDate, reports.Status, reports.StatusNotes FROM reports"
> strquery = strquery & " WHERE ((reports.BB_Approval='Awaiting
> Approval') and (reports.CustomerID=13)) ORDER BY reports.YourRef
> DESC,reports.Serial;"
>
>
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to retrieve form field value if form is EncType=multipart/form-dataForm? Li Zhang ASP .Net 4 02-27-2009 01:23 AM
How to have email form send email and start file download bmurphy@xlrotor.com Javascript 13 05-14-2006 06:27 PM
<form>...</form> - how to supress blank space after </form> in IE? rob c Javascript 4 12-30-2005 06:10 PM
submit form, validate form, set cookie, send email, download file mhawkins19@adelphia.net Javascript 1 03-17-2005 08:19 AM
Problem Sending email form web form =?Utf-8?B?SnVzdGlu?= ASP .Net 3 02-21-2005 01:39 PM



Advertisments