linket overskrifter
Hej!Skulle der ske at være en der på en forståelig måde, kunne hjælpe mig med at lave det nedenstående sådan, at når jeg går ind på opskrifter, så kommer kun overskiften frem hvorfra man så kan klikke sig videre på den man ønsker. Derudover ønsker jeg også de skal kaldes fra DB'en i alfabetisk rækkefølge.
Filerne er som følgende;
sign_opskrifter.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Systematics homekitchen</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<script language="JavaScript">window.status = ""</script>
<script language="javascript" src="validering_kokken.js"></script>
<style>@import url("systematic.css");
BODY { SCROLLBAR-FACE-COLOR: #ffffff;
SCROLLBAR-HIGHLIGHT-COLOR: #ff0000;
SCROLLBAR-SHADOW-COLOR: #cccccc;
SCROLLBAR-3DLIGHT-COLOR: #DFDFDF;
SCROLLBAR-ARROW-COLOR: #ff0000;
SCROLLBAR-TRACK-COLOR: #ffffff;
SCROLLBAR-DARKSHADOW-COLOR: #ffffff
}
</style>
</head>
<body>
<table width="680" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80"><img src="grafik/trans.gif" width="80" height="30" border="0"></td>
<td colspan="3"> </td>
</tr>
<tr>
<td> </td>
<td width="12" valign="top" class="overskrifter"><span class="administration"><a href="administration.asp" onFocus="this.blur()" target="_self"><img src="grafik/trekant_tilbage.gif" width="12" height="17" border="0"></a></span>
</td>
<td width="10" valign="top" class="overskrifter"><span class="administration"><img src="grafik/trans.gif" width="30" height="6"></span><br>
</td>
<td width="578" valign="top" class="overskrifter"><div align="left">Admin
- tilføj opskrift<br>
<img src="grafik/trans.gif" width="6" height="20"></div></td>
</tr>
<tr>
<td> </td>
<td colspan="3" class="broedtxt"><form name="new_comment" action="add_opskrift.asp" method="post">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="96" height="30" class="mellemoverskrift"> Navn</td>
<td width="315" height="30"> <input name="navn" maxlength="46" type="text" class="inputfield" size="30">
</td>
</tr>
<tr>
<td height="30" valign="top" class="broedtxt"> <img src="grafik/trans.gif" width="6" height="2"><br>
<span class="mellemoverskrift">Opskrift</span> </td>
<td height="30"><textarea name="text" cols="39" rows="10" wrap="virtual" class="inputfield" id="text"></textarea></td>
</tr>
<tr>
<td> </td>
<td height="45"> <input type="hidden" name="StrMode" value="new_comment">
<input name="button" type="button" class="button" onFocus="this.blur()" onClick="validering()" value="tilføj opskrift">
</td>
</tr>
<tr>
<td height="30" colspan="2"> <table border="0" bordercolor="#000000" <% if Session("error") = true then response.write "cellpadding=""5""" else response.write "cellpadding=""0""" end if %> cellspacing="0">
<tr>
<td class="broedtxt" <% if Session("error") = true then response.write "bordercolor=""red""" end if %> >
<%
if Session("error") = true then
response.write "Following mistake has occured<br>" & Session("message")
Session("error") = false
end if
%> </td>
</tr>
</table></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
add_opskrifter.asp:
<style type="text/css">
<!--
@import url("systematic.css");
-->
</style>
<%
'Set the response buffer to true as we maybe redirecting
Response.Buffer = True
strMode = request.form("strMode")
'If the session variable is False or does not exsist then redirect the user to the unauthorised user page
If strMode <> "new_comment" then
'Redirect to user start page
Response.Redirect "index.asp"
End If
'Dimension variables
Dim strInputComments 'Holds the Users comments
Dim saryCommentWord 'Array to hold each word in the comments enetred by the user
Dim intCheckWordLengthLoopCounter 'Loop counter
Dim intWordLength 'Holds the length of the word to be checked
Dim blnWordLenthOK 'Boolean set to False if any words in the description are above 80 characters
Dim intLongestWordLength 'Holds the number of characters in the longest word entered in the
'Read in user deatils from the kokken (DB users.db) form
strInputComments = Request.Form("text")
'Split-up each word in the comments from the user to check that no word entered is over 50 characters
saryCommentWord = Split(Trim(strInputComments), " ")
'Initialse the word length variable
blnWordLenthOK = True
'Loop round to check that each word in the comments entered by the user is not above 70 characters
For intCheckWordLengthLoopCounter = 0 To UBound(saryCommentWord)
'Initialise the intWordLength variable with the length of the word to be searched
intWordLength = Len(saryCommentWord(intCheckWordLengthLoopCounter))
'Get the number of characters in the longest word
If intWordLength => intLongestWordLength Then
intLongestWordLength = intWordLength
End If
'If the word length to be searched is more than or equal to 70 then set the blnWordLegthOK to false
If intWordLength => 80 Then
blnWordLenthOK = False
End If
Next
If blnWordLenthOK = True Then
Set Rs = Server.CreateObject ("ADODB.Connection")
set rec = server.createobject("ADODB.recordset")
Rs.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.MapPath("../Systematic/users.mdb")
Rec.open "opskrifter", Rs, 2, 3
Dim dato
dato = date()
Dim tid
tid = time()
navn = Request ("navn")
email = Request ("email")
comment = Request ("text")
if comment = "" then
comment = "Der er ikke indtastet nogen opskrift!"
end if
Rec.Addnew
Rec("nick") = navn
Rec("email") = email
Rec("text") = comment
Rec("dato") = dato
Rec("tid") = tid
REC.Update
Rec.close
set Rec=nothing
Response.redirect "opskrifter.asp"
else
Session("error") = true
Session("message") = "Beklager, men det er ikke lovligt at taste over 46 tegn!"
Response.redirect "sign_opskrifter.asp"
end if
%>
opskrifter.asp:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Systematics køkken</title>
<META NAME="Generator" CONTENT="Stone's WebWriter 3.5">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
@import url(test/systematic.css);
-->
</style>
<style>
BODY { SCROLLBAR-FACE-COLOR: #ffffff;
SCROLLBAR-HIGHLIGHT-COLOR: #ff0000;
SCROLLBAR-SHADOW-COLOR: #cccccc;
SCROLLBAR-3DLIGHT-COLOR: #DFDFDF;
SCROLLBAR-ARROW-COLOR: #ff0000;
SCROLLBAR-TRACK-COLOR: #ffffff;
SCROLLBAR-DARKSHADOW-COLOR: #ffffff
}
</style>
<style type="text/css">
<!--
@import url("systematic.css");
-->
</style>
</head>
<body class="overskrifter">
<table width="680" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80"><img src="grafik/trans.gif" width="80" height="30"></td>
<td colspan="2"></td>
</tr>
<tr>
<td></td>
<td width="240" valign="top" class="overskrifter"><table width="93%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="grafik/overskrifter/opskrifter.gif" width="240" height="24"></td>
</tr>
<tr>
<td><img src="grafik/trans.gif" width="6" height="15"></td>
</tr>
</table></td>
<td width="360" valign="top" class="overskrifter"><form name="form1" method="post" action="search.asp">
<div align="right">
<input type="text" name="Keyword" size="30">
<input type="submit" value="søg opskrift" name="Action">
</div>
</form></td>
</tr>
<tr>
<td></td>
<td colspan="2" valign="top" class="broedtxt"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> <span class="overskrifter">
<%
' Databaseforbindelse - husk at angive sti til din database
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("users.mdb")
Conn.Open DSN
' SQL forespørgsel - asc = sætter opskrifterne i alfabetisk rækkefølge i forhold til 'nick' = navn på opskrift
strSQL = "Select * from opskrifter order by nick asc"
' Udfør forespørgsel (objRec indeholder nu resultatet)
Set objRec = Conn.Execute(strSQL)
do while not objRec.eof
comment = Replace(objrec("text"), vbCrLf, "<BR>")
response.write "<table border=""1"" bordercolor=""#cccccc"" width=""550"" cellpadding=""20"" cellspacing=""3""><tr><td bordercolor=""#cccccc"">"
response.write "<table width=""550"" align=""center"" cellpadding=""0"" cellspacing=""0""><tr class=""broedtxt"">"
response.write "<span class=""mellemoverskrift"">" & objrec("nick") & "</span>"
response.write "</td><td align=""right"" background=""system/td_back.gif"">"
response.write "</td></tr>"
response.write "<tr><td colspan=""2"">"
response.write "<table class=""broedtxt"" cellpadding=""0"" cellspacing=""0"" width=""100%""><tr><td>"
response.write comment
response.write "</td></tr></table>"
response.write "</td></tr>"
response.write "<tr class=""datotidDB""><td background=""system/td_back2.gif"">"
response.write "date: " & objrec("dato")
response.write "</td><td align=""right"" background=""system/td_back2.gif"">"
response.write "time: " & objrec("tid")
response.write "</td></tr></table>"
response.write "</td></tr></table>"
response.write "<br><br>"
objRec.movenext
loop
' Luk databaseforbindelse
Conn.Close
Set Conn = Nothing
%>
</span> </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
På forhånd tak!
//D
