With pleasure.........
I ASP:
------------------------------------------------------------------
<%
Response.Buffer = True
Function fixQuotes( theString )
fixQuotes = Replace( theString, "'", "''" )
End Function
news = Request( "news" )
writer = Request( "writer" )
if news = "" or writer = "" then
Rewsponse.Write "Fejl! Du har ikke udfyldt alle felter!<BR><A HREF="java script:history.go(-1)">Gå tilbage og ret det!</A>"
'Response.Redirect "default.asp"
End If
Set Con = Server.CreateObject( "ADODB.Connection" )
DBPath = "DBQ=" & server.mappath("news/news.mdb")
Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & DBPath
If Request.Servervariables("Content_Length") > 0 THEN
Sql = "INSERT INTO news (Date1, News, Writer) VALUES('" & Date() & "','" & fixQuotes( News ) & "','" & fixQuotes( Writer ) & "')"
Con.Execute Sql
End If
%>
<html>
<head>
<title> [ designforlife ] | graphic design </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="kristian, kruse, lehn, web, internet, design, grafisk, logo, banner, adobe, photoshop, it">
<meta name="description" content=" [ designforlife ] is a site about graphic design.">
<meta name="author" content=" [ designforlife ] ">
<meta name="robots" content="all">
<link rel="shortcut icon" href="
http://www.designforlife.dk/favicon.ico"><link rel="stylesheet" href="../files/dfl.css" type="text/css">
<script language="JavaScript1.2" type="text/javascript" src="../files/dfl.js"></script>
<script language="JavaScript1.2">
function MM_openBrWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br>
<form action="news.asp" method="POST" target="_self">
<table border="0" width="470" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" width="227">News:</td>
<td width="243">
<textarea cols="30" rows="8" name="News"></textarea>
</td>
</tr>
<tr>
<td width="227">Writer:</td>
<td width="243">
<input type="text" name="Writer" class="bg2">
</td>
</tr>
<tr>
<td align="center" width="227"> <br>
<br>
<input type="submit" value="Add news" class="submit" name="submit" onClick="MM_openBrWindow('news/added.asp','thanks','width=150,height=10')">
<input type="button" name="Submit" value="See news" class="button" onclick="location.href='news/shownews.asp'">
</td>
</tr>
</table>
</form>
</body>
</html>
------------------------------------------------------------------
Eller i Javascript....
------------------------------------------------------------------
<%
Response.Buffer = True
Function fixQuotes( theString )
fixQuotes = Replace( theString, "'", "''" )
End Function
news = Request( "requirednews" )
writer = Request( "requiredwriter" )
Set Con = Server.CreateObject( "ADODB.Connection" )
DBPath = "DBQ=" & server.mappath("news/news.mdb")
Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & DBPath
If Request.Servervariables("Content_Length") > 0 THEN
Sql = "INSERT INTO news (Date1, News, Writer) VALUES('" & Date() & "','" & fixQuotes( News ) & "','" & fixQuotes( Writer ) & "')"
Con.Execute Sql
End If
%>
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: wsabstract.com -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!!
http://javascript.internet.com -->
<!-- Begin
function checkrequired(which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,8)=="required") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
}
}
}
}
if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
alert(""+shortFieldName+" feltet var ikke udfylt korrekt!");
return false;
}
else
return true;
}
// End -->
</script>
<title> [ designforlife ] | graphic design </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="kristian, kruse, lehn, web, internet, design, grafisk, logo, banner, adobe, photoshop, it">
<meta name="description" content=" [ designforlife ] is a site about graphic design.">
<meta name="author" content=" [ designforlife ] ">
<meta name="robots" content="all">
<link rel="shortcut icon" href="
http://www.designforlife.dk/favicon.ico"><link rel="stylesheet" href="../files/dfl.css" type="text/css">
<script language="JavaScript1.2" type="text/javascript" src="../files/dfl.js"></script>
<script language="JavaScript1.2">
function MM_openBrWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br>
<form action="news.asp" method="POST" target="_self" onSubmit="return checkrequired(this)">
<table border="0" width="470" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" width="227">News:</td>
<td width="243">
<textarea cols="30" rows="8" name="requiredNews"></textarea>
</td>
</tr>
<tr>
<td width="227">Writer:</td>
<td width="243">
<input type="text" name="requiredWriter" class="bg2">
</td>
</tr>
<tr>
<td align="center" width="227"> <br>
<br>
<input type="submit" value="Add news" class="submit" name="submit" onClick="MM_openBrWindow('news/added.asp','thanks','width=150,height=10')">
<input type="button" name="Submit" value="See news" class="button" onclick="location.href='news/shownews.asp'">
</td>
</tr>
</table>
</form>
</body>
</html>
------------------------------------------------------------------