Cookies i formular
Jeg har denne her kode som er en formular der sender email til bruger:<% @LANGUAGE = VBScript %>
<% Option Explicit %>
<html>
<head>
<title>Formular</title>
</head>
<body bgcolor=#ffffff>
<%
Dim strName, strEmail, strQuery, strAdresse, strBy, strTlf, strTlfArbejde, strSagsnr, strSalgsopstilling
strName = Trim(Request.Form(\"ClientName\"))
strAdresse = Trim(Request.Form(\"ClientAdresse\"))
strBy = Trim(Request.Form(\"ClientBy\"))
strTlf = Trim(Request.Form(\"ClientTlf\"))
strTlfArbejde = Trim(Request.Form(\"ClientTlfArbejde\"))
strEmail = Trim(Request.Form(\"ClientEmail\"))
strQuery = Trim(Request.Form(\"ClientQry\"))
strSagsnr = Trim(Request.Form(\"ClientSagsnr\"))
strSalgsopstilling = Trim(Request.Form(\"ClientSalgsopstilling\"))
If (strName <> \"\" And strAdresse <> \"\" And strBy <> \"\") Then
Dim objMail, aRecipients
Set objMail = Server.CreateObject(\"CDONTS.NewMail\")
objMail.From = \"xx@xx.dk\"
objMail.To = strEmail
objMail.Subject = \"Fremsendelse af opstilling via eMail til \" & strName
objMail.AttachFile Server.MapPath (strSalgsopstilling)
objMail.Body = \"Hermed fremsendes opstilling på den bestilte ejendom: \" & strSagsnr
objMail.send
Response.Write \"Tak for din bestilling ! \" & strName
Set objMail = Nothing
Else
%>
<FORM ACTION=\"<%=Request.ServerVariables(\"SCRIPT_NAME\")%>\" METHOD=POST>
<input type=\"HIDDEN\" name=\"ClientSalgsopstilling\" size=\"9\" value=\"<%=request.querystring(\"Salgsopstilling\")%>\" style=\"font-size: 8 pt; border-style: solid\">
<div align=\"center\">
<center>
<TABLE BORDER=0 width=\"550\">
<tr><td width=\"530\" colspan=\"6\">Du har valgt at bestille en opstilling på :</td></tr>
</center>
<tr><td width=\"102\" colspan=\"2\">
</td>
<td width=\"428\" colspan=\"4\"></td></tr>
<tr><td width=\"102\" colspan=\"2\">
</td>
<td width=\"428\" colspan=\"4\"></td></tr>
<tr><td width=\"102\" colspan=\"2\" align=\"right\">
<p align=\"right\"></td>
<center>
<td width=\"95\" align=\"right\"><b>Sagsnr</b>:</td>
<td width=\"333\" colspan=\"3\"><input type=\"text\" name=\"ClientSagsnr\" size=\"14\" value=\"<%=request.querystring(\"Sagsnr\")%>\" style=\"font-weight: bold; border-style: solid; border-color: #FFFFFF\"></td></tr>
</center>
<tr><td width=\"102\" colspan=\"2\" align=\"right\">
<p align=\"right\"></td>
<center>
<td width=\"96\" align=\"right\"><b>Beliggenhed</b>:</td>
<td width=\"333\" colspan=\"3\"><input type=\"text\" name=\"ClientBeliggenhed\" size=\"39\" value=\"<%=request.querystring(\"Beliggenhed\")%>\" style=\"font-weight: bold; border-style: solid; border-color: #FFFFFF\"></td></tr>
<tr><td width=\"91\"></td><td width=\"11\"></td><td width=\"428\" colspan=\"4\"></td></tr>
<tr><td width=\"530\" colspan=\"6\">
Salgsopstillingen skal sendes til :</td></tr>
<tr><td width=\"91\">Navn:</td><td width=\"11\"><img border=\"0\" src=\"../images/stjerne.gif\" width=\"10\" height=\"10\"></td><td width=\"428\" colspan=\"4\"><INPUT TYPE=TEXT NAME=\"ClientName\" VALUE=\"\" SIZE=57></td></tr>
<tr><td width=\"91\">Adresse:</td><td width=\"11\"><img border=\"0\" src=\"../images/stjerne.gif\" width=\"10\" height=\"10\"></td><td width=\"428\" colspan=\"4\"><input type=\"text\" name=\"ClientAdresse\" size=\"57\"></td></tr>
<tr><td width=\"91\">Postnr. og by:</td><td width=\"11\"><img border=\"0\" src=\"../images/stjerne.gif\" width=\"10\" height=\"10\"></td><td width=\"428\" colspan=\"4\"><input type=\"text\" name=\"ClientBy\" size=\"57\"></td></tr>
<tr>
<td width=\"91\">Tlf:</td><td width=\"11\"></td><td width=\"428\" colspan=\"4\"><input type=\"text\" name=\"ClientTlf\" size=\"18\" tabindex=\"4\">Tlf (arbejde/mobil):<input type=\"text\" name=\"ClientTlfArbejde\" size=\"20\" tabindex=\"5\"></td>
</tr>
<tr><td width=\"91\">e-mail adresse</td><td width=\"11\"></td><td width=\"428\" colspan=\"4\"><INPUT NAME=\"ClientEmail\" SIZE=57 tabindex=\"6\"></td></tr>
<tr><td width=\"91\"></td><td width=\"11\"></td><td width=\"428\" colspan=\"4\"></td></tr>
<tr><td width=\"91\"></td><td width=\"11\"></td><td width=\"94\"></td><td width=\"90\"></td><td width=\"16\"></td><td width=\"220\"></td></tr>
<tr><td width=\"91\"></td><td width=\"11\"></td><td width=\"94\"><INPUT TYPE=SUBMIT VALUE=\"Send\"></td><td width=\"90\"></td><td width=\"16\"><img border=\"0\" src=\"../images/stjerne.gif\" width=\"10\" height=\"10\" align=\"right\"></td><td width=\"220\">skal
udfyldes</td></tr>
<tr><td width=\"302\" colspan=\"5\"></td><td width=\"220\"></td></tr>
<tr><td width=\"302\" colspan=\"5\"></td><td width=\"220\"></td></tr>
</TABLE>
</center>
</div>
</FORM>
<% End If %>
</body>
</html>
Her har jeg koden som laver en cookie og læser en ´cookie. Hvordan oh hvorhenne skal jeg sætte denne her kode ind i den ovenstående.
<%
Response.Buffer = True
If Request.Form(\"Action\") = \"Send\" Then
\' Værdier fra formen felter lægges i en Cookie som vi kalder SteensForm
Response.Cookies(\"SteensForm\")(\"ClientName\") = Request.Form(\"ClientName\")
Response.Cookies(\"SteensForm\")(\"ClientEmail\") = Request.Form(\"ClientEmail\")
Response.Cookies(\"SteensForm\")(\"ClientQuery\") = Request.Form(\"ClientQuery\")
Response.Cookies(\"SteensForm\")(\"ClientAdresse\") = Request.Form(\"ClientAdresse\")
Response.Cookies(\"SteensForm\")(\"ClientBy\") = Request.Form(\"ClientBy\")
Response.Cookies(\"SteensForm\")(\"ClientTlf\") = Request.Form(\"ClientTlf\")
Response.Cookies(\"SteensForm\")(\"ClientTlfArbejde\") = Request.Form(\"ClientTlfArbejde\")
\' Cookien skal udløbe om et år
Response.Cookies(\"SteensForm\").Expires = Date+365
\' Cookien skal kun kunne læses af www.vipiil.dk
Response.Cookies(\"SteensForm\").Domain = \".www.vipiil.dk\"
\' Cookien skal kun kunne læses af sider som ligger i denne mappe
Response.Cookies(\"SteensForm\").Path = \"/Databaser\"
End If
\' Her hentes værdierne fra ASPCookien ind i to variabler
strName = Request.Cookies(\"SteensForm\")(\"ClientName\")
strEmail = Request.Cookies(\"SteensForm\")(\"ClientEmail\")
strQuery = Request.Cookies(\"SteensForm\")(\"ClientQuery\")
strAdresse = Request.Cookies(\"SteensForm\")(\"ClientAdresse\")
strBy = Request.Cookies(\"SteensForm\")(\"ClientBy\")
strTlf = Request.Cookies(\"SteensForm\")(\"ClientTlf\")
strTlfArbejde = Request.Cookies(\"SteensForm\")(\"ClientTlfArbejde\")
%>
<html><head>
<title>test</title><body>
<form method=\"POST\" action=\"test.asp\">
<table height=\"56\">
<tr><td width=\"91\">Navn:</td><td width=\"439\"><INPUT TYPE=TEXT NAME=\"ClientName\" VALUE=\"<%=strName%>\" SIZE=33></td></tr>
<tr><td width=\"91\">Email:</td><td width=\"439\"><INPUT TYPE=TEXT NAME=\"ClientEmail\" VALUE=\"<%=strEmail%>\" SIZE=33></td></tr>
<tr><td width=\"91\">Bemærkninger:</td><td width=\"439\"><INPUT TYPE=TEXT NAME=\"ClientQuery\" VALUE=\"<%=strQuery%>\" SIZE=33></td></tr>
<tr><td width=\"91\">Adresse:</td><td width=\"439\"><INPUT TYPE=TEXT NAME=\"ClientAdresse\" VALUE=\"<%=strAdresse%>\" SIZE=33></td></tr>
<tr><td width=\"91\">By:</td><td width=\"439\"><INPUT TYPE=TEXT NAME=\"ClientBy\" VALUE=\"<%=strBy%>\" SIZE=33></td></tr>
<tr><td width=\"91\">Tlf:</td><td width=\"439\"><INPUT TYPE=TEXT NAME=\"ClientTlf\" VALUE=\"<%=strTlf%>\" SIZE=33></td></tr>
<tr><td>TlfArbejde</td><td><INPUT TYPE=TEXT NAME=\"ClientTlfArbejde\" size=\"30\" VALUE=\"<%=strTlfArbejde%>\" SIZE=33></td></tr>
<tr><td height=\"23\"></td><td height=\"23\"></tr>
<tr><td height=\"25\"></td><td height=\"25\"></tr>
</table>
<input type=\"Submit\" name=\"Action\" value=\"Send\">
</form>
Jeg har prøvet meget og får typisk en fejl om heeder ?????
