Hi there... As I am now totally fed up with ASP (and still forced to work with it), how the hell do I Submit Data to a database AND send an email using the form variables... I have tried different ways, even by using 2 pages, but can only manage to do one or the other function (mail OR database entries).
Below is the code of the page with the form, and the second post is the code for the second page sending the mail. PLEASE...! Can someone PLEASE help me with this stupid ASP crap...!!!
Below is the code of the page with the form, and the second post is the code for the second page sending the mail. PLEASE...! Can someone PLEASE help me with this stupid ASP crap...!!!
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/connection1.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
If (CStr(Request("MM_insert")) = "formail") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_connection1_STRING
MM_editCmd.CommandText = "INSERT INTO feedback (Email, FirstName, FirstName) VALUES (?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("email")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 50, Request.Form("subject")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, Request.Form("message")) ' adVarWChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
End If
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Feedback</title>
<link href="assets/css/SiteGlobal.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body,td,th {
font-family: Tahoma, Geneva, sans-serif;
}
-->
</style></head>
<body leftmargin="0" topmargin="0">
<div class="HomeHeader"></div>
<div class="DivWrapper">
<div class="MainTable">
<p class="Date">comments & feedback</p>
<div class="SideNav">
<p class="SideNavHeads"><a href="index.html" class="SideNavLinks">» home</a> <a href="#" class="SideNavLinks">» viewable threads</a><a href="witbank/index.html" class="SideNavLinks"></a></p>
<p class="SideNavHeads">Related Items</p>
<p class="SideNavHeads"><a href="links.html" class="SideNavLinks">» links</a> <a href="#" class="SideNavLinks">» latest updates</a><a href="http://chhzrhsrv650/EN/Pages/default.aspx" class="SideNavLinks">» xstrata plc</a> <a href="search.html" class="SideNavLinks">» search</a></p>
<p class="SideNavHeads">Administration</p>
<p class="SideNavHeads"><a href="pages/admin/adm_login.asp" class="SideNavLinks">» it administration</a></p>
<p class="SideNavHeads"><a href="#"></a></p>
</div>
<p class="Heading1">Feedback</p>
<div class="MainInfo">
<p>Please give us your feedback on this intranet site. You can add suggestions, comments, something you want us to add or anything related to this intranet site. </p>
</div>
<div class="NormalText1">
<form name="formail" method="POST" action="feedback_sendmail.asp">
<table align="center" cellpadding="3" cellspacing="1">
<tr>
<td>Email</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td>Subject</td>
<td><input type="text" name="subject" /></td>
</tr>
<tr>
<td>Message</td>
<td><textarea name="message"></textarea></td>
</tr>
<tr>
<td colspan="2"> <input type="submit" value="send" name="submit" /> </td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="formail" />
</form>
</div>
<p> </p>
</div>
<p class="Footer">Copyright © 2009 Xstrata Coal South Africa. All rights reserved | <a href="#" class="FooterLinks">Internet Usage Policy</a> | <a href="#" class="FooterLinks">IT Department</a> | <a href="#" class="FooterLinks">Credits</a></p>
</div>
</body>
</html>