Kopiraj ovaj kod i snimi ga kao
contactus.html stranu:
<html>
<head>
<title>ASP konktakt forma</title>
</head>
<body>
<form method="POST" action="contactusprocess.asp">
<table>
<tr>
<td>Vase ime:</td>
<td><input name="Name" size="25" maxlength="50"></td>
</tr>
<tr>
<td>Vas Email:</td>
<td><input name="Email Address" size="25" maxlength="50"></td>
</tr>
<tr>
<td>Vas Telefon:</td>
<td><input name="Telephone No" size="25" maxlength="50"> </td>
</tr>
<tr>
<td valign="top">Vasa poruka:</td>
<td><textarea cols="24" name="Message" rows="6"></textarea> </td>
</tr>
<tr>
<td colspan="2"><div align="center"><center><p><input type="submit" value="Submit"
name="Submit"> </p>
</center></div><div align="center"><center><p></td>
</tr>
</table>
</form>
</body>
</html>
Kopiraj ovaj kod ispod i snimi ga kao
contactusprocess.asp<%
'''''''''''''''''''''''''''''
Dim error
error = 0
For Each f In Request.Form
If Request.Form(f) = "" Then
error = 1
End If
Next
If error=1 Then
response.redirect "error.html"
Else
Dim f, emsg, mail_to, r, o, c, other
mail_to = "tvoja@email-adresa.com"
fline = "_______________________________________________________________________"& vbNewLine
hline = vbNewLine & "_____________________________________"& vbNewLine
emsg = ""
For Each f In Request.Form
If mid(f,1,1)<>"S" = True Then 'do not save if input name starts with S
emsg = emsg & f & " = " & Trim(Request.Form(f)) & hline
End If
Next
Set objNewMail = Server.CreateObject("CDONTS.NewMail")
objNewMail.From = Request("Email Address")
objNewMail.Subject = "Poruka sa kontakt strane"
objNewMail.To = mail_to
objNewMail.Body = emsg & fline
objNewMail.Send
Set objNewMail = Nothing
response.redirect "hvala.html"
End if
%>
Takodje napravi i
hvala.html stranu
<html>
<head>
<title>Poruka poslata.</title>
</head>
<body>
<p align="center"> </p>
<p align="center"><strong>Vasa poruka je poslata.</strong></p>
<p align="center"><strong>Hvala.</strong></p>
</body>
</html>
i napravi
error.html stranu:
<html>
<head>
<title>ERROR</title>
</head>
<body>
<p align="center"><strong>GRESKA</strong></p>
<p align="center">Niste uneli sva polja</p>
<p align="center"><a href="javascript:history.go(-1)"><< Vratite se natrag</a></p>
</body>
</html>