Ved tryk på knap fortolkes asp kode ikke?
Hej Ved tryk på knap "sendemail" sker der ikke det som jeg ønsker nemlig at koden efter ..If Request.Form("sendmail") <> "" Then... udføres.
Er der en der kan hjælpe mig med at finde ud af hvad jeg mangler i nedenstående kode for at få programmet til at virke?
mvh Flemming
<% @LANGUAGE = VBScript %>
<% Option Explicit %>
<%
If Request.Form("sendmail") <> "" Then
Dim Conn
Dim rs, Flog
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={MySQL};SERVER=localhost;DATABASE=skemaevaluering;UID=<uid>;PASSWORD=<pwd>"
dim taeller,st,l,i,t,ny,strsql
randomize timer
taeller = 3
st = "abcdefghijklmnopqrstuxyzwv"
l = len(st)
for i = 0 to taeller
t = int(l*rnd) + 1
ny = ny + (mid(st, t,1))
next
if request.Form("navn") <> "" and request.Form("email") <> "" then
strSQL = "INSERT INTO TESTPERSON (TESTNAVN,TESTTYPE,TESTPERSONNAVN,TESTPERSONEMAIL,FIRMA,UID,PASSWORD,AKTIV,SENDT) VALUES ("
strSQL = strSQL & "'gratistest',"
strSQL = strSQL & "'trivselsanalyse',"
strSQL = strSQL & "'" & Request.Form("navn") & "',"
strSQL = strSQL & "'" & Request.Form("email") & "',"
strSQL = strSQL & "'" & Request.Form("virksomhed") & "',"
strSQL = strSQL & "'" & Request.Form("email") & "',"
strsql = strSql & "'" & ny & "',"
strsql = strsql & "'J',"
strSQL = strSQL & "'J')"
Conn.Execute(strSQL)
else
FLog = "Både" & Chr(160) & "navn" & Chr(160) & "og" & Chr(160) & "email" & Chr(160) & "skal" & Chr(160) & "være" & chr(160) & "udfyldt"
end if
set conn = nothing
set rs = nothing
dim objmail,objmail1,temp
Set objMail = Server.CreateObject( "CDONTS.NewMail" )
objMail.BodyFormat = 0
objMail.To = "fl_poulsen@hotmail.com"
objMail.From = "skema@skemaevaluering.dk"
objMail.Subject = "Trivselsanalyse"
temp = "http://www.skemaevaluering.dk/startside.asp?testnavn=gratistest&testtype=trivselsanalyse"
objMail.Body = ""
objMail.Body = "Hej" & chr(160) & Request.Form("navn")&"<br />"&"<br />"&"Du har valgt at gennemføre en gratitest "
objMail.Body = objMail.Body & " Som en del af denne undersøgelse inviteres du nu til at udfylde et spørgeskema vedr. din hverdag. "
objMail.Body = objMail.Body & "<br />" & "<br />"&"Tryk på nedenstående link og log på med de medfølgende oplysninger om login og password. Derefter guides du igennem testen."
objMail.Body = objMail.Body & "<br />" & "<br />" & "God fornøjelse" & "<p><a href=" & temp & ">Her kan du logge på testen</a></p>" & vbcrlf & "Login: " & Request.Form("navn") & "<br />" & "Password: " & ny & "<br />" & "<br />" & "<br />" & "<br />" & "<br />" & "<br />" & "<br />" & "<br />" & "<br />"
objMail.Host = "mailout.one.com"
objMail.Send
Set objMail1 = Server.CreateObject( "CDONTS.NewMail" )
objMail1.BodyFormat = 0
objMail1.To = "fl_poulsen@hotmail.com"
objMail1.From = "skema@skemaevaluering.dk"
objMail1.Subject = "Gratistest sendt til .... "
objMail1.Body = ""
objMail1.Body = "Navn :" & chr(160) & Request.Form("navn")& "<br />" & "Email :" & chr(160) & Request.Form("email")&"<br />"&"Virksomhed:"& chr(160)&Request.Form("virksomhed")
objMail1.Host = "mailout.one.com"
objMail1.Send
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>Bruus/Rasmussen</title>
<style type="text/css">
<!--
.style2 {
font-size: 36px;
font-family: Verdana;
color: #0083A7;
}
.style3 {font-size: 24px}
.style6 {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #0095B6;
text-decoration: none;
}
a {
text-decoration: none;
color: #0095B6;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
-->
</style>
</head>
<body>
<form action='gratistest.asp' method='post'>
<div align="center">
<table width="665" border="0" align="center">
<tr>
<th width="484" scope="col"><div align="left"></div></th>
<th width="186" align="right" scope="col"><img src="Billeder/KBRLOGO_SIDE2_CMYK.gif" width="186" height="109" /></th>
</tr>
<tr>
<th height="406" colspan="2" align="center" valign="middle" scope="row"><table width="571" border="0" align="center">
<tr align="center" valign="top">
<td height="11" colspan="2" align="left" background="CV'er/Smede - Tyskland.pdf" class="style6"><p>Ved at sende os dit navn, din e-mail adresse samt hvilken virksomhed du arbejder i, får du tilsendt login til spørgesemaet. Du kan derefter besvare spørgeskemaet og ved selvsyn se, hvad det går ud på. </p>
<p> </p>
</td>
</tr>
<tr align="center" valign="top">
<td height="11" align="left" background="CV'er/Smede - Tyskland.pdf" class="style6">
<p>Navn</p>
<p>Virksomhed</p>
<p>e-mail</p>
<form id="form1" name="form1" method="post" action="">
<label>
</label>
<div align="center"></div>
</form>
</td>
<td height="11" align="left" background="CV'er/Smede - Tyskland.pdf" class="style6"> <input name="navn" size="31"><p><input name="virksomhed" size="31"></p>
<p><input name="email" size="31"></td>
</tr>
<tr align="center" valign="top">
<td height="10" colspan="2" align="left" background="CV'er/Smede - Tyskland.pdf" class="style6"> </td>
</tr>
<tr align="center" valign="top">
<td height="10" colspan="2" align="left" background="CV'er/Smede - Tyskland.pdf" class="style6">
<p align="center">
<label>
<input type='submit' name='sendmail' value='Send testmail' style="background-color: #FFFFFF; width:157; height:22; float:left; font-weight:700"></label></td>
</tr>
<tr align="center" valign="top">
<td width="149" align="left" class="style6"> </td>
<td width="412" align="right" class="style6"> </td>
</tr>
</table> </th>
</tr>
<tr>
<th colspan="2" scope="row"><img src="Billeder/Sidefod.gif" width="674" height="28" /></th>
</tr>
</table>
</div>
<p align="center" class="style2"> </p>
<p align="center" class="style2"> </p>
<p align="center" class="style2 style3"> </p>
</form>
</body>
</html>