Hej NG!
Jeg har nedenstående kode til oprettelse af en ordre i en DB, bekræftelsen,
er på samme side og det virker fint.
Jeg vil gerne have den til at maile samtidigt ved oprettelsen. Men det kan
jeg skisme ikke lige hitte. Som den er nu skal man manuelt klikke send, for
at maile resultatet...
Vil være lykkelig for lidt hjælp.
Med venlig hilsen
Per Ahm
________________________
<%
SalesRep = Request.Form("SalesRep")
Cust = Request.Form("Customer")
CustCity = Request.Form("CustomerAddrCity")
CustPhone = Request.Form("CustomerPhone")
CustContact = Request.Form("CustomerContact")
CustEmail = Request.Form("CustomerEmail")
PortDate = Request.Form("PortDate")
jobart = Request.Form("jobart")
SalesNotes = Request.Form("SalesNotes")
If Len(SalesRep) = 0 Then
%>
<html>
<head>
<title>Opret ordre...</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/admin.css" type="text/css">
<style>
..buttoncls {
background-color: #6699CC;
border-width: 1;
color: #FEFEFE;
font-size: 8pt;
font-family: tahoma,verdana,arial;
}
</style>
</head>
<body bgcolor="#ecece4" text="#000000">
<form action="order.asp" method="post">
<table width="610" border="0" cellspacing="0" cellpadding="1"
align="center" bgcolor="#003366">
<tr>
<td>
<table width="610" border="0" cellspacing="2" cellpadding="0"
align="center" bgcolor="#6699CC">
<tr>
<td class="headers1" width="129" align="right">Mood Media</td>
<td width="277"> </td>
<td width="204"> </td>
</tr>
<tr>
<td width="129" height="31" align="right"
class="normaltxt">Salgs
Rep:</td>
<td colspan="2" height="31">
<p><select size="1" name="SalesRep">
<option>Poul Damholdt, Mood Media</option>
<option>Bettina, Mood Media</option>
<option>Karin, Mood Media</option>
<option>Jan Hansen, Mavt</option>
<option>Carsten Klyden, Mavt</option>
</select></p>
</td>
</tr>
</table>
<table width="610" border="0" cellspacing="2" cellpadding="0"
align="center" bgcolor="#6699cc">
<tr>
<td class="headers1" width="129" align="right">Kunde Info</td>
<td width="277"> </td>
<td width="204"> </td>
</tr>
<tr>
<td width="129" height="31" align="right" class="normaltxt">
<p class="normaltxt" align="right"> Firma:</p>
</td>
<td colspan="2" height="31">
<input type="text" name="Customer" class="normaltxt">
</td>
</tr>
<tr>
<td width="129" height="31" align="right" class="normaltxt">
Post / By:</td>
<td colspan="2" height="31">
<input type="text" name="CustomerAddrCity" class="normaltxt">
</td>
</tr>
<tr>
<td width="129" height="31" align="right" class="normaltxt">
<div align="right">Telefon:</div>
</td>
<td colspan="2" height="31">
<input type="text" name="CustomerPhone" class="normaltxt" >
</td>
</tr>
<tr>
<td width="129" height="31" align="right"
class="normaltxt">Kontaktperson:</td>
<td colspan="2" height="31">
<input type="text" name="CustomerContact" class="normaltxt" >
</td>
</tr>
<tr>
<td width="129" height="31" align="right"
class="normaltxt">Email:</td>
<td colspan="2" height="31">
<input type="text" name="CustomerEmail" class="normaltxt" >
</td>
</tr>
<tr>
<td width="129" height="31" align="right" class="normaltxt">
Udførelses dato:</td>
<td colspan="2" height="31">
<input type="text" name="PortDate"
value="<%response.write(date())%>" class="normaltxt" >
</td>
</tr>
<tr>
<td colspan="3" height="31" align="right" class="normaltxt">
<div align="left"></div>
</td>
</tr>
</table>
<table width="610" border="0" cellspacing="2" cellpadding="0"
align="center" bgcolor="#6699cc">
<tr>
<td width="129" align="right"
class="normaltxt"><b>Jobart:</b></td>
<td width="477">
<p><select size="1" name="jobart">
<option>Vælg jobart</option>
<option>Service</option>
<option>Ny installation</option>
</select></p>
</td>
</tr>
<tr>
<td colspan="2" align="right" class="normaltxt">
<div align="left">
<p> </p>
</div>
</td>
</tr>
</table>
<table width="610" border="0" cellspacing="2" cellpadding="0"
align="center" bgcolor="#6699cc">
<tr>
<td width="129" align="right" class="headers1">Installation</td>
<td> </td>
</tr>
<tr>
<td width="129" align="right" class="normaltxt"
valign="top">Fejlbeskrivelse
Installations detaljer</td>
<td>
<textarea name="SalesNotes" rows="6" cols="50"
class="normaltxt" ></textarea>
</td>
</tr>
<tr>
<td width="129" align="right" class="normaltxt"
valign="top"> </td>
<td class="normaltxt"> </td>
</tr>
<tr>
<td width="129" align="right" class="normaltxt"
valign="top"> </td>
<td class="normaltxt">
<input class="buttoncls" type="submit" name="Submit"
value="Gem ordre">
<input type="reset" name="Submit2" value="Nulstil"
class="buttoncls">
<input type="button" name="Button52" value="Ordre oversigt"
class="buttoncls" href="javascript:void"
onClick='window.top.location="orderreport.asp"'>
<input type="button" name="Button5" value="Forsiden"
class="buttoncls" href="javascript:void"
onClick='window.top.location="service.asp"'>
</td>
</tr>
<tr>
<td width="129" align="right" class="normaltxt"
valign="top"> </td>
<td class="normaltxt"> </td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
<%
Else
Dim DBName, objConn, objRS, strSQL
'Path to the Database
DBName = server.mappath("..\..\DB\orders.mdb")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DBQ=" & DBName & ";Driver={Microsoft Access
Driver (*.mdb)};"
objConn.Open
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "INSERT INTO CustInfo (SalesRep, Customer, CustCity, CustPhone,
CustContact, CustEmail, CustEstPortDate, Status, jobart, InstallNote) VALUES
('" & SalesRep & "', '" & Cust & "', '" & CustCity & "', '" & CustPhone &
"', '" & CustContact & "', '" & CustEmail & "', '" & PortDate & "', '1', '"
& jobart & "', '" & Salesnotes & "')"
Set objRS= objConn.execute(strSQL)
%>
<html>
<head>
<title>Din ordre er gemt...</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/admin.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000" >
<style>
..buttoncls {
background-color: #6699CC;
border-width: 1;
color: #FEFEFE;
font-size: 8pt;
font-family: tahoma,verdana,arial;
}
</style>
<table width="610" border="0" cellspacing="4" cellpadding="0"
align="center">
<tr>
<td colspan="2" class="headers1">
<p>
</p></td></tr>
<tr height="20">
<td colspan="2" class="normaltxt">
<form name="form2" method="post" action="">
<input type="button" name="Button52" value="Ordre oversigt"
class="buttoncls" href="javascript:void"
onClick='window.top.location="orderreport.asp"'>
<input type="button" name="Button892" value="Forsiden"
class="buttoncls" href="javascript:void"
onClick='window.top.location="service.asp"'>
</form></td></tr>
<tr>
<td width="129" align="right" class="normaltxt"> </td><td
class="normaltxt"> </td></tr>
</table>
<table width="610" border="0" cellspacing="4" cellpadding="0"
align="center">
<tr>
<td class="headers1" width="129" align="right">Mood Media</td><td
width="277"> </td><td width="204"> </td></tr>
<tr>
<td width="129" align="right" class="normaltxt" height="20">Salgs
Rep:</td><td colspan="2" class="headers1" height="20"><%= SalesRep %>
</td></tr>
<tr>
<td colspan="3" align="right" class="normaltxt">
<div align="left"> <img border="0" src="images/adminbar.gif"
width="400" height="1">
</div></td></tr>
</table>
<table width="610" border="0" cellspacing="4" cellpadding="0"
align="center">
<tr>
<td width="124" align="right" class="normaltxt" height="20">Ordre
Status:</td><td class="headers1" height="20" width="474">
<font color="#339900">Open</font>
</td></tr>
<tr>
<td colspan="3" align="right" class="normaltxt">
<div align="left"> <img border="0" src="adminbar.gif" width="400"
height="1">
</div></td></tr>
</table><table width="610" border="0" cellspacing="4" cellpadding="0"
align="center">
<tr>
<td class="headers1" width="129" align="right">Kunde Info</td><td
width="277"> </td><td width="204"> </td></tr>
<tr>
<td width="129" align="right" class="normaltxt" height="20">
<p class="normaltxt" align="right">Firma:</p></td><td colspan="2"
class="headers1" height="20"><%= Cust %></td></tr>
<tr>
<td width="129" height="20" align="right" class="normaltxt">Post /
By:</td><td colspan="2" height="20" class="headers1"><%= CustCity
%></td></tr>
<tr>
<td width="129" align="right" class="normaltxt" height="20">
<div align="right">Telefon:</div></td><td colspan="2"
class="headers1" height="20"><%= CustPhone %></td></tr>
<tr>
<td width="129" align="right" class="normaltxt" height="20">Kontakt
person:</td><td colspan="2" class="headers1" height="20"><%= CustContact
%></td></tr>
<tr>
<td width="129" align="right" class="normaltxt"
height="20">Email:</td><td colspan="2" class="headers1" height="20"><%=
CustEmail %></td></tr>
<tr>
<td width="129" align="right" class="normaltxt"
height="20">Udførelses dato:</td><td colspan="2" class="headers1"
height="20"><%= PortDate %></td></tr>
<tr>
<td colspan="3" align="right" class="normaltxt">
<div align="left">
<input type="image" border="0" name="imageField"
src="adminbar.gif" width="400" height="1">
</div></td></tr>
</table>
<table width="610" border="0" cellspacing="4" cellpadding="0"
align="center">
<tr>
<tr height="25">
<tr>
<td width="129" align="right" class="normaltxt"
height="20">Jobart:</td><td width="477" class="headers1" height="20"><%=
jobart %></td></tr>
<tr>
<td colspan="2" align="right" class="normaltxt">
<div align="left">
<input type="image" border="0" name="imageField3"
src="adminbar.gif" width="400" height="1">
</div></td></tr>
</table>
<table width="610" border="0" cellspacing="4" cellpadding="0"
align="center">
<tr>
<td width="129" align="right"
class="headers1">Installation</td><td> </td></tr>
<tr height="20">
<td width="129" align="right" class="normaltxt"
valign="top">Fejlbeskrivelse
Installations detaljer</td><td class="headers1"><%= SalesNotes
%></td></tr>
<tr>
<td width="129" align="right" class="normaltxt"
valign="top"> </td><td class="normaltxt"> </td></tr>
</table>
<FORM action="
http://mail.mavt.dk/cgi-sys/formmail.pl" method="POST">
<INPUT type="hidden" name="recipient" value="ordre@mavt.dk">
<INPUT type="hidden" name="subject" value="Nyoprettet ordre: <%= jobart %>">
<INPUT TYPE=hidden NAME=redirect
VALUE="
http://www.mavt.dk/service/service.asp">
<div align="center">
<center>
<table border="0">
<tr>
<td><font face="Arial" size="2">
<textarea rows="1" name="Kunde" cols="1" tabindex="3">
<%= Cust %>, <%= CustCity %>
Tlf: <%= CustPhone %>
Jobtype: <%= jobart %>
Bemærkninger: <%= SalesNotes %>
Dato: <%= PortDate %>
Oprettet af: <%= SalesRep %>
</textarea><INPUT TYPE="submit" VALUE="Send ordren pr. mail"></font></td>
</tr>
<tr>
<td>
<p align="center"></p>
</td>
</tr>
</table>
</center>
</div>
</form>
</body>
</html>
<%
End IF
%>