Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to grab items from result set and email them?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I hope you folks can help. I've always found great assistance on this board.
I have a table in SQL Server, and I used the Database Results Wizard to format a section on an ASP.
I'd like to allow my users to select one or more items (not necessarily consecutive) from the list, click a button and email the selected items to a fixed email address.
It seems a bit like a shopping cart concept, but I am fairly new to ASP - and I just don't know the answer.
I do not have a 'check box' in the SQL Server table, and would hesitate to do that because I can have multiple users hitting the same rows.
Thanks in advance for any and all assistance...
 
You can try to create check boxes on the web page where you display your list. When the check box is selected you add the appropriate row to the string that should be sent. You don't even have to reconnect to the database in order to send these items.
 
You should have something similar to this in the code:
<%@ Language=VBScript %>
<%
Dim strSend 'Message to be sent
Dim n
Dim Mail
%>
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<title>Sample - send the selected items via e-mail</title>
</HEAD>
<BODY>
<form name=&quot;send&quot; action=&quot;sendparticularitems.asp?action=send&quot; method=&quot;post&quot;>
<table border=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<td><INPUT type=&quot;checkbox&quot; id=ch_1 name=ch_1 value=&quot;1&quot;></td>
<td><INPUT type=&quot;text&quot; id=txt_1 name=txt_1 value=&quot;Item 1&quot;></td>
</tr>
<tr>
<td><INPUT type=&quot;checkbox&quot; id=ch_2 name=ch_2 value=&quot;1&quot;></td>
<td><INPUT type=&quot;text&quot; id=txt_2 name=txt_2 value=&quot;Item 2&quot;></td>
</tr>
<tr>
<td><INPUT type=&quot;checkbox&quot; id=ch_3 name=ch_3 value=&quot;1&quot;></td>
<td><INPUT type=&quot;text&quot; id=txt_3 name=txt_3 value=&quot;Item 3&quot;></td>
</tr>
</table>
<input type=&quot;submit&quot; value=&quot;Send Items&quot; id=&quot;submit&quot; name=&quot;submit&quot;>
<input type=&quot;reset&quot; value=&quot;Reset&quot; id=&quot;reset&quot; name=&quot;reset&quot;>
</form>
<%
If Request.QueryString(&quot;action&quot;)=&quot;send&quot; Then
strSend=&quot;&quot;
For n = 1 to 3
If Request.Form(&quot;ch_&quot; & n) = &quot;1&quot; Then
strSend = strSend & &quot; &quot; & Request.Form(&quot;txt_&quot; & n)
End If
Next
End If

If strSend<>&quot;&quot; Then
Set Mail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
Mail.To = &quot;mail1@mail.com&quot;
Mail.From = &quot;mail2@mail.com&quot;
Mail.Subject = &quot;Order&quot;
Mail.Body = &quot;Order: &quot; & strSend
Mail.Send
Set Mail=Nothing
End If
%>
</BODY>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top