View Single Post
Old 01-22-2010, 08:14 PM   #1
thinkdolphin
 
Join Date: Aug 2009
Posts: 4
Question Sending an email from Insert Record

Can anyone tell me what to do to send an email with info from the Insert Record form to an email address? But JUST certain fields, not the whole form so there will be exclusions.

Here is the generated code:

Code:
<!--#include file="../Connections/Comm_Choice.asp" -->
<%
// *** Edit Operations: declare variables
// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
if (Request.QueryString) {
  MM_editAction += "?" + Server.HTMLEncode(Request.QueryString);
}
// boolean to abort record edit
var MM_abortEdit = false;
%>
<%
if (String(Request("MM_insert")) == "form1") {
  if (!MM_abortEdit) {
    // execute the insert
 
    var MM_editCmd = Server.CreateObject ("ADODB.Command");
    MM_editCmd.ActiveConnection = MM_Comm_Choice_STRING;
    MM_editCmd.CommandText = "INSERT INTO Entertainment (All_Around, Bagels, Bakery, Bar, BBQ, Beer, Bingo, Breakfast, Brunch, Buffet, Burger, Cake, Candy, Chicken, Chinese, Coffee_Shop, Cookies, Comedy, Coffee_Cup, Dance, Deli, Delivery, Dessert, Dinner, Dinner_10, Donuts, Fast_Food, Fastest_Lunch, Happy_Hour, Healthy_Food, Hoagie, Hotdog, Ice_Cream, Italian, Japanese, Lunch_Delivered, Lunch_Spot, Mediterranean, Mexican, Night_Spot, Pizza_Chain, Pizza_Nonchain, Rest_Atmosphere, Ribs, Romantic, Spaghetti, Sports_Bar, Steakhouse, Wings, Your_Name, Your_Address, Your_City, Your_State, Your_Phone, Your_Email, Your_Age, Subscriber) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    MM_editCmd.Prepared = true;
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param1", 202, 1, 255, Request.Form("All_Around"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param2", 202, 1, 255, Request.Form("Bagels"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param3", 202, 1, 255, Request.Form("Bakery"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param4", 202, 1, 255, Request.Form("Bar"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param5", 202, 1, 255, Request.Form("BBQ"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param6", 202, 1, 255, Request.Form("Beer"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param7", 202, 1, 255, Request.Form("Bingo"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param8", 202, 1, 255, Request.Form("Breakfast"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param9", 202, 1, 255, Request.Form("Brunch"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param10", 202, 1, 255, Request.Form("Buffet"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param11", 202, 1, 255, Request.Form("Burger"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param12", 202, 1, 255, Request.Form("Cake"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param13", 202, 1, 255, Request.Form("Candy"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param14", 202, 1, 255, Request.Form("Chicken"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param15", 202, 1, 255, Request.Form("Chinese"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param16", 202, 1, 255, Request.Form("Coffee_Shop"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param17", 202, 1, 255, Request.Form("Cookies"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param18", 202, 1, 255, Request.Form("Comedy"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param19", 202, 1, 255, Request.Form("Coffee_Cup"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param20", 202, 1, 255, Request.Form("Dance"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param21", 202, 1, 255, Request.Form("Deli"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param22", 202, 1, 255, Request.Form("Delivery"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param23", 202, 1, 255, Request.Form("Dessert"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param24", 202, 1, 255, Request.Form("Dinner"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param25", 202, 1, 255, Request.Form("Dinner_10"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param26", 202, 1, 255, Request.Form("Donuts"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param27", 202, 1, 255, Request.Form("Fast_Food"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param28", 202, 1, 255, Request.Form("Fastest_Lunch"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param29", 202, 1, 255, Request.Form("Happy_Hour"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param30", 202, 1, 255, Request.Form("Healthy_Food"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param31", 202, 1, 255, Request.Form("Hoagie"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param32", 202, 1, 255, Request.Form("Hotdog"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param33", 202, 1, 255, Request.Form("Ice_Cream"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param34", 202, 1, 255, Request.Form("Italian"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param35", 202, 1, 255, Request.Form("Japanese"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param36", 202, 1, 255, Request.Form("Lunch_Delivered"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param37", 202, 1, 255, Request.Form("Lunch_Spot"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param38", 202, 1, 255, Request.Form("Mediterranean"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param39", 202, 1, 255, Request.Form("Mexican"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param40", 202, 1, 255, Request.Form("Night_Spot"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param41", 202, 1, 255, Request.Form("Pizza_Chain"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param42", 202, 1, 255, Request.Form("Pizza_Nonchain"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param43", 202, 1, 255, Request.Form("Rest_Atmosphere"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param44", 202, 1, 255, Request.Form("Ribs"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param45", 202, 1, 255, Request.Form("Romantic"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param46", 202, 1, 255, Request.Form("Spaghetti"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param47", 202, 1, 255, Request.Form("Sports_Bar"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param48", 202, 1, 255, Request.Form("Steakhouse"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param49", 202, 1, 255, Request.Form("Wings"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param50", 202, 1, 255, Request.Form("Your_Name"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param51", 202, 1, 255, Request.Form("Your_Address"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param52", 202, 1, 255, Request.Form("Your_City"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param53", 202, 1, 255, Request.Form("Your_State"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param54", 202, 1, 255, Request.Form("Your_Phone"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param55", 202, 1, 255, Request.Form("Your_Email"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param56", 5, 1, -1, (String(Request.Form("Your_Age")) != "undefined" && String(Request.Form("Your_Age")) != "") ? Request.Form("Your_Age") : null)); // adDouble
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param57", 202, 1, 255, Request.Form("Subscriber"))); // adVarWChar
    MM_editCmd.Execute();
    MM_editCmd.ActiveConnection.Close();
    // append the query string to the redirect URL
    var MM_editRedirectUrl = "thankyou.html";
    if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count > 0) {
      MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1) ? "?" : "&") + Request.QueryString;
    }
    Response.Redirect(MM_editRedirectUrl)
  }
}
%>
TIA!
Dahn
thinkdolphin is offline   Reply With Quote